fix wrong assertion on tests

Signed-off-by: xin.li <xin.li@daocloud.io>
This commit is contained in:
xin.li
2025-02-22 12:39:01 +08:00
parent 0a08529144
commit bc4ae15d77
17 changed files with 177 additions and 61 deletions

View File

@@ -217,7 +217,9 @@ func TestReadinessAggregatedAPIServiceDiscovery(t *testing.T) {
}
}))
go func() {
require.NoError(t, service.Run(ctx))
if err := service.Run(ctx); err != nil {
t.Errorf("unexpected error %v", err)
}
}()
require.NoError(t, service.WaitForReady(ctx))
@@ -306,7 +308,9 @@ func TestAggregatedAPIServiceDiscovery(t *testing.T) {
}
}))
go func() {
require.NoError(t, service.Run(ctx))
if err := service.Run(ctx); err != nil {
t.Errorf("unexpected error %v", err)
}
}()
require.NoError(t, service.WaitForReady(ctx))

View File

@@ -69,7 +69,9 @@ func TestSlowAPIServiceOpenAPIDoesNotBlockHealthCheck(t *testing.T) {
http.ServeContent(w, r, "/openapi/v2", time.Now(), bytes.NewReader(data))
}))
go func() {
require.NoError(t, service.Run(ctx))
if err := service.Run(ctx); err != nil {
t.Errorf("unexpected error %v", err)
}
}()
require.NoError(t, service.WaitForReady(ctx))
@@ -131,7 +133,9 @@ func TestFetchingOpenAPIBeforeReady(t *testing.T) {
http.ServeContent(w, r, "/openapi/v2", time.Now(), bytes.NewReader(data))
}))
go func() {
require.NoError(t, service.Run(ctx))
if err := service.Run(ctx); err != nil {
t.Errorf("unexpected error %v", err)
}
}()
require.NoError(t, service.WaitForReady(ctx))

View File

@@ -136,7 +136,9 @@ func BuildAndRunTestServer(t *testing.T, caPath, caKeyPath, issuerOverride strin
writer.WriteHeader(http.StatusOK)
err = json.NewEncoder(writer).Encode(token)
require.NoError(t, err)
if err != nil {
t.Errorf("unexpected error %v", err)
}
})
mux.HandleFunc(authWebPath, func(writer http.ResponseWriter, request *http.Request) {
@@ -150,7 +152,9 @@ func BuildAndRunTestServer(t *testing.T, caPath, caKeyPath, issuerOverride strin
writer.WriteHeader(http.StatusOK)
err := json.NewEncoder(writer).Encode(keySet)
require.NoError(t, err)
if err != nil {
t.Errorf("unexpected error %v", err)
}
})
return oidcServer