mirror of
https://github.com/kubeshark/kubeshark.git
synced 2026-08-23 14:26:38 +00:00
* Rename `mizu` to `kubeshark` * Rename `up9inc` to `kubeshark` * Change the logo, title, motto and the main color * Replace the favicon * Update the docs link * Change the copyright text in C files * Remove a comment * Rewrite the `README.md` and update the logo and screenshots used in it * Add a `TODO` * Fix the grammar * Fix the bottom text in the filtering guide * Change the Docker Hub username of cross-compilation intermediate images * Add an install script * Fix `docker/login-action` in the CI * Delete `build-custom-branch.yml` GitHub workflow * Update `README.md` * Remove `install.sh` * Change the motto back to "Traffic viewer for Kubernetes"
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package controllers
|
|
|
|
import (
|
|
"net/http/httptest"
|
|
"testing"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/kubeshark/kubeshark/agent/pkg/dependency"
|
|
"github.com/kubeshark/kubeshark/agent/pkg/oas"
|
|
)
|
|
|
|
func TestGetOASServers(t *testing.T) {
|
|
recorder, c := getRecorderAndContext()
|
|
|
|
GetOASServers(c)
|
|
t.Logf("Written body: %s", recorder.Body.String())
|
|
}
|
|
|
|
func TestGetOASAllSpecs(t *testing.T) {
|
|
recorder, c := getRecorderAndContext()
|
|
|
|
GetOASAllSpecs(c)
|
|
t.Logf("Written body: %s", recorder.Body.String())
|
|
}
|
|
|
|
func TestGetOASSpec(t *testing.T) {
|
|
recorder, c := getRecorderAndContext()
|
|
|
|
c.Params = []gin.Param{{Key: "id", Value: "some"}}
|
|
|
|
GetOASSpec(c)
|
|
t.Logf("Written body: %s", recorder.Body.String())
|
|
}
|
|
|
|
func getRecorderAndContext() (*httptest.ResponseRecorder, *gin.Context) {
|
|
dependency.RegisterGenerator(dependency.OasGeneratorDependency, func() interface{} {
|
|
return oas.GetDefaultOasGeneratorInstance(-1)
|
|
})
|
|
|
|
recorder := httptest.NewRecorder()
|
|
c, _ := gin.CreateTestContext(recorder)
|
|
oas.GetDefaultOasGeneratorInstance(-1).Start()
|
|
oas.GetDefaultOasGeneratorInstance(-1).GetServiceSpecs().Store("some", oas.NewGen("some"))
|
|
return recorder, c
|
|
}
|