• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gatewayd-io / gatewayd / 22284621791

22 Feb 2026 08:19PM UTC coverage: 59.676% (+0.2%) from 59.468%
22284621791

push

github

web-flow
Extensive plugin tests (#731)

* Add test fixtures for plugin-specific CI tests

- Mock prediction API (mock_sqli_api.py) for sql-ids-ips plugin
- Auth plugin fixtures: credentials, Casbin model and policy
- JS plugin test hooks script
- GatewayD config with startupParams for auth plugin tests
- Update .gitignore to allow testdata/plugins/

* Refactor test-plugin CI to test all OSS plugins via matrix strategy

Replace the single plugin-template-go test with a matrix of four real
plugin tests (cache, auth, js, sql-ids-ips), each with plugin-specific
behavioral assertions:

- cache: Redis-backed query caching, invalidation on writes, TLS
- auth: cleartext auth, invalid credential rejection, Casbin RBAC
- js: Goja-based JS hook interception, query logging, TLS
- sql-ids-ips: legitimate query passthrough, SQLi pattern blocking
  (OR 1=1, UNION SELECT, stacked queries) via mock prediction API

* Fix cache TLS and auth plugin CI test failures

- Remove duplicate SELECT from cache TLS test (cache hit returns raw
  bytes that break the TLS connection)
- Add connect_timeout=5 to all auth psql URLs to fail fast instead of
  hanging indefinitely
- Increase auth startup wait to 3s

* Remove cache TLS test due to cache plugin TLS bug

The cache plugin corrupts TLS connection state after caching a SELECT
response, causing subsequent connections to fail. Cache behavior is
fully tested over plaintext. TLS passthrough is tested by other plugins.

* Bring back the TLS test

* Flush cache before starting test

* Instal redis-cli for testing

* Pin cache plugin

* Fix connection pool exhaustion caused by tight loop in PassThroughToClient

When the client-to-server goroutine expired the backend read deadline,
PassThroughToClient ignored the resulting error if received == 0,
causing the server-to-client goroutine to spin forever. This prevented
connection cleanup and eventually exhausted the backend pool.

* Fetch latest version

4 of 4 new or added lines in 1 file covered. (100.0%)

38 existing lines in 4 files now uncovered.

5791 of 9704 relevant lines covered (59.68%)

17.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

73.33
/network/stack.go
1
package network
2

3
import "sync"
4

5
type Request struct {
6
        Data []byte
7
}
8

9
type Stack struct {
10
        items []*Request
11
        mu    sync.RWMutex
12
}
13

14
func (s *Stack) Push(req *Request) {
4✔
15
        s.mu.Lock()
4✔
16
        defer s.mu.Unlock()
4✔
17

4✔
18
        s.items = append(s.items, req)
4✔
19
}
4✔
20

21
func (s *Stack) GetLastRequest() *Request {
×
22
        s.mu.RLock()
×
23
        defer s.mu.RUnlock()
×
24

×
25
        if len(s.items) == 0 {
×
26
                return nil
×
27
        }
×
28

29
        return s.items[len(s.items)-1]
×
30
}
31

32
func (s *Stack) PopLastRequest() *Request {
4✔
33
        s.mu.Lock()
4✔
34
        defer s.mu.Unlock()
4✔
35

4✔
36
        if len(s.items) == 0 {
4✔
UNCOV
37
                return nil
×
UNCOV
38
        }
×
39

40
        lastItem := len(s.items) - 1
4✔
41
        req := s.items[lastItem]
4✔
42
        s.items = append(s.items[:lastItem], s.items[lastItem+1:]...)
4✔
43
        return req
4✔
44
}
45

46
func (s *Stack) UpdateLastRequest(req *Request) {
4✔
47
        s.mu.Lock()
4✔
48
        defer s.mu.Unlock()
4✔
49

4✔
50
        if len(s.items) == 0 {
4✔
51
                return
×
52
        }
×
53

54
        s.items[len(s.items)-1] = req
4✔
55
}
56

57
func (s *Stack) Clear() {
2✔
58
        s.mu.Lock()
2✔
59
        defer s.mu.Unlock()
2✔
60

2✔
61
        s.items = make([]*Request, 0)
2✔
62
}
2✔
63

64
func NewStack() *Stack {
2✔
65
        return &Stack{
2✔
66
                items: make([]*Request, 0),
2✔
67
                mu:    sync.RWMutex{},
2✔
68
        }
2✔
69
}
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc