package services import ( "context" "testing" "github.com/stretchr/testify/assert" "edge-infra.dev/pkg/edge/apis/meta" ) const ( projectID = "test-org" testServiceAccountEmail = "test-app@appspot.gserviceaccount.com" testOauth2ClientID = "test-oauth-2-client-id" cluster = "test-store" clusterComponent = "test" serviceAccountName = "ksnttqqgp4oy-test" ) func TestCreateServiceAccount(t *testing.T) { ctx := context.Background() displayName := "test-store-display-name" desc := "test-desc" saName, _ := meta.ResourceName(cluster, clusterComponent) iamComponent, err := iamservice.CreateServiceAccount(ctx, projectID, saName, displayName, desc) assert.NoError(t, err) assert.NotNil(t, iamComponent) } func TestCreateIAMRoles(t *testing.T) { regularIamRole := NewIamRole("test-role") assert.Equal(t, "serviceAccount:name@pid.iam.gserviceaccount.com", regularIamRole.getMemberName("pid", "name")) wiIamRole := NewWIIamRole("test-role", "ns", "k8s-name") assert.Equal(t, "serviceAccount:pid.svc.id.goog[ns/k8s-name]", wiIamRole.getMemberName("pid", "name")) }