ResourceClient: Exercise resource client in k8s apis tests (#93473)
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/options"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/apis"
|
||||
@@ -31,8 +32,9 @@ func TestIntegrationRequiresDevMode(t *testing.T) {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
helper := apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{
|
||||
AppModeProduction: true, // should fail
|
||||
DisableAnonymous: true,
|
||||
AppModeProduction: true, // should fail
|
||||
DisableAnonymous: true,
|
||||
APIServerStorageType: options.StorageTypeUnifiedGrpc, // tests remote connection
|
||||
EnableFeatureToggles: []string{
|
||||
featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs, // Required to start the example service
|
||||
},
|
||||
|
||||
@@ -41,6 +41,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/team/teamimpl"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/services/user/userimpl"
|
||||
"github.com/grafana/grafana/pkg/storage/unified/resource"
|
||||
"github.com/grafana/grafana/pkg/tests/testinfra"
|
||||
)
|
||||
|
||||
@@ -74,6 +75,12 @@ func NewK8sTestHelper(t *testing.T, opts testinfra.GrafanaOpts) *K8sTestHelper {
|
||||
|
||||
c.loadAPIGroups()
|
||||
|
||||
// ensure unified storage is alive and running
|
||||
ctx := identity.WithRequester(context.Background(), c.Org1.Admin.Identity)
|
||||
rsp, err := c.env.ResourceClient.IsHealthy(ctx, &resource.HealthCheckRequest{})
|
||||
require.NoError(t, err, "unable to read resource client health check")
|
||||
require.Equal(t, resource.HealthCheckResponse_SERVING, rsp.Status)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
@@ -485,6 +492,7 @@ func (c *K8sTestHelper) CreateUser(name string, orgName string, basicRole org.Ro
|
||||
require.Equal(c.t, orgId, u.OrgID)
|
||||
require.True(c.t, u.ID > 0)
|
||||
|
||||
// should this always return a user with ID token?
|
||||
s, err := userSvc.GetSignedInUser(context.Background(), &user.GetSignedInUserQuery{
|
||||
UserID: u.ID,
|
||||
Login: u.Login,
|
||||
|
||||
Reference in New Issue
Block a user