Running tool: /usr/local/go/bin/go test -timeout 30s -run ^TestApiService$ github.com/riotpot/test/api
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
[GIN-debug] GET /api/proxies/ --> github.com/riotpot/pkg/api.getProxies (3 handlers)
[GIN-debug] POST /api/proxies/ --> github.com/riotpot/pkg/api.createProxy (3 handlers)
[GIN-debug] GET /api/proxies/:id/ --> github.com/riotpot/pkg/api.getProxy (3 handlers)
[GIN-debug] PATCH /api/proxies/:id/ --> github.com/riotpot/pkg/api.patchProxy (3 handlers)
[GIN-debug] DELETE /api/proxies/:id/ --> github.com/riotpot/pkg/api.delProxy (3 handlers)
[GIN-debug] POST /api/proxies/:id/port --> github.com/riotpot/pkg/api.changeProxyPort (3 handlers)
[GIN-debug] POST /api/proxies/:id/status --> github.com/riotpot/pkg/api.changeProxyStatus (3 handlers)
[GIN-debug] GET /api/proxies/:id/:id/ --> github.com/riotpot/pkg/api.getService (3 handlers)
[GIN-debug] PATCH /api/proxies/:id/:id/ --> github.com/riotpot/pkg/api.patchService (3 handlers)
[GIN-debug] DELETE /api/proxies/:id/:id/ --> github.com/riotpot/pkg/api.delService (3 handlers)
[GIN-debug] GET /api/services/ --> github.com/riotpot/pkg/api.getServices (3 handlers)
[GIN-debug] POST /api/services/ --> github.com/riotpot/pkg/api.createService (3 handlers)
[GIN-debug] POST /api/services/new/ --> github.com/riotpot/pkg/api.newServiceAndProxy (3 handlers)
[GIN-debug] GET /api/services/:id/ --> github.com/riotpot/pkg/api.getService (3 handlers)
[GIN-debug] PATCH /api/services/:id/ --> github.com/riotpot/pkg/api.patchService (3 handlers)
[GIN-debug] DELETE /api/services/:id/ --> github.com/riotpot/pkg/api.delService (3 handlers)
[GIN] 2024/03/01 - 18:45:57 | 400 | 111.422µs | | POST "/api/services/"
[GIN] 2024/03/01 - 18:45:57 | 200 | 33.123µs | | GET "/api/services/"
--- FAIL: TestApiService (0.00s)
/home/mehul/dev/gsoc/riotpot/test/api/api_test.go:82:
Error Trace: /home/mehul/dev/gsoc/riotpot/test/api/api_test.go:82
Error: Not equal:
expected: &api.CreateService{Name:"Test Service", Port:8080, Host:"localhost", Network:"tcp", Interaction:""}
actual : &api.CreateService{Name:"", Port:0, Host:"", Network:"", Interaction:""}
Diff:
--- Expected
+++ Actual
@@ -1,6 +1,6 @@
(*api.CreateService)({
- Name: (string) (len=12) "Test Service",
- Port: (int) 8080,
- Host: (string) (len=9) "localhost",
- Network: (string) (len=3) "tcp",
+ Name: (string) "",
+ Port: (int) 0,
+ Host: (string) "",
+ Network: (string) "",
Interaction: (string) ""
Test: TestApiService
/home/mehul/dev/gsoc/riotpot/test/api/api_test.go:91:
Error Trace: /home/mehul/dev/gsoc/riotpot/test/api/api_test.go:91
Error: Not equal:
expected: 1
actual : 0
Test: TestApiService
FAIL
FAIL github.com/riotpot/test/api 0.013s
FAIL
Also I found this conflicting that in the
api_test.gowhile we initialize the router we register the api.ServicesRouter to the router -:riotpot/test/api/api_test.go
Line 24 in 6d13c90
But in the
parse.gowe register the api.ServiceRouter -:riotpot/cmd/riotpot/parse.go
Line 75 in 6d13c90
So probably in the
parse.gowe should add theapi.Services.Router, because in the current implementation the endpoints provided by theservicesRoutesare not available because they are not registered either as the parent or a child.