mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-27 21:38:06 +00:00
Commit
This commit is contained in:
@@ -41,8 +41,9 @@ func outputSpec(label string, spec *openapi.OpenAPI, t *testing.T) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestEntries(t *testing.T) {
|
func TestEntries(t *testing.T) {
|
||||||
logger.InitLoggerStderrOnly(logging.INFO)
|
logger.InitLoggerStderrOnly(logging.DEBUG)
|
||||||
files, err := getFiles("./test_artifacts/")
|
//files, err := getFiles("/media/bigdisk/UP9/trcc/alon-up9")
|
||||||
|
files, err := getFiles("/media/bigdisk/UP9")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Log(err)
|
t.Log(err)
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
@@ -51,6 +52,22 @@ func TestEntries(t *testing.T) {
|
|||||||
loadStartingOAS("test_artifacts/catalogue.json", "catalogue")
|
loadStartingOAS("test_artifacts/catalogue.json", "catalogue")
|
||||||
loadStartingOAS("test_artifacts/trcc.json", "trcc-api-service")
|
loadStartingOAS("test_artifacts/trcc.json", "trcc-api-service")
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
time.Sleep(1 * time.Second)
|
||||||
|
GetOasGeneratorInstance().ServiceSpecs.Range(func(key, val interface{}) bool {
|
||||||
|
svc := key.(string)
|
||||||
|
t.Logf("Getting spec for %s", svc)
|
||||||
|
gen := val.(*SpecGen)
|
||||||
|
_, err := gen.GetSpec()
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
cnt, err := feedEntries(files, true)
|
cnt, err := feedEntries(files, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Log(err)
|
t.Log(err)
|
||||||
@@ -157,6 +174,12 @@ func TestFileSingle(t *testing.T) {
|
|||||||
|
|
||||||
if len(diff) > 0 {
|
if len(diff) > 0 {
|
||||||
t.Errorf("Generated spec does not match expected:\n%s", diff.String())
|
t.Errorf("Generated spec does not match expected:\n%s", diff.String())
|
||||||
|
if os.Getenv("MIZU_OAS_WRITE_FILES") != "" {
|
||||||
|
err = ioutil.WriteFile(file+".spec.json", []byte(specText), 0644)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
@@ -69,7 +69,11 @@ func TestOpMerging(t *testing.T) {
|
|||||||
{nil, nil, nil},
|
{nil, nil, nil},
|
||||||
{&openapi.Operation{}, nil, &openapi.Operation{}},
|
{&openapi.Operation{}, nil, &openapi.Operation{}},
|
||||||
{nil, &openapi.Operation{}, &openapi.Operation{}},
|
{nil, &openapi.Operation{}, &openapi.Operation{}},
|
||||||
{&openapi.Operation{}, &openapi.Operation{}, &openapi.Operation{}},
|
{
|
||||||
|
&openapi.Operation{OperationID: "op1"},
|
||||||
|
&openapi.Operation{OperationID: "op2"},
|
||||||
|
&openapi.Operation{OperationID: "op1"},
|
||||||
|
},
|
||||||
// has historicIds
|
// has historicIds
|
||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
|
Reference in New Issue
Block a user