diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 419394634..e693aa751 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -80,7 +80,7 @@ SERVICE_TOKEN_PATH=/workspaces/bucketeer/tools/dev/cert/service-token \ API_KEY_NAME="e2e-test-$(date +%s)-client" \ API_KEY_PATH=/workspaces/bucketeer/tools/dev/cert/api_key_client \ API_KEY_ROLE=SDK_CLIENT \ -ENVIRONMENT_NAMESPACE=e2e \ +ENVIRONMENT_ID=e2e \ make create-api-key ``` @@ -91,7 +91,7 @@ SERVICE_TOKEN_PATH=/workspaces/bucketeer/tools/dev/cert/service-token \ API_KEY_NAME="e2e-test-$(date +%s)-server" \ API_KEY_PATH=/workspaces/bucketeer/tools/dev/cert/api_key_server \ API_KEY_ROLE=SDK_SERVER \ -ENVIRONMENT_NAMESPACE=e2e \ +ENVIRONMENT_ID=e2e \ make create-api-key ``` @@ -105,7 +105,7 @@ GATEWAY_CERT_PATH=/workspaces/bucketeer/tools/dev/cert/tls.crt \ SERVICE_TOKEN_PATH=/workspaces/bucketeer/tools/dev/cert/service-token \ API_KEY_PATH=/workspaces/bucketeer/tools/dev/cert/api_key_client \ API_KEY_SERVER_PATH=/workspaces/bucketeer/tools/dev/cert/api_key_server \ -ENVIRONMENT_NAMESPACE=e2e \ +ENVIRONMENT_ID=e2e \ ORGANIZATION_ID=default \ make e2e ``` diff --git a/Makefile b/Makefile index c5e57c42f..3c9e7c667 100644 --- a/Makefile +++ b/Makefile @@ -235,7 +235,7 @@ create-api-key: --name=${API_KEY_NAME} \ --role=${API_KEY_ROLE} \ --output=${API_KEY_PATH} \ - --environment-namespace=${ENVIRONMENT_NAMESPACE} \ + --environment-id=${ENVIRONMENT_ID} \ --no-profile \ --no-gcp-trace-enabled @@ -250,7 +250,7 @@ e2e-l4: -gateway-port=9000 \ -gateway-cert=${GATEWAY_CERT_PATH} \ -service-token=${SERVICE_TOKEN_PATH} \ - -environment-namespace=${ENVIRONMENT_NAMESPACE} \ + -environment-id=${ENVIRONMENT_ID} \ -test-id=${TEST_ID} .PHONY: e2e @@ -265,7 +265,7 @@ e2e: -gateway-port=443 \ -gateway-cert=${GATEWAY_CERT_PATH} \ -service-token=${SERVICE_TOKEN_PATH} \ - -environment-namespace=${ENVIRONMENT_NAMESPACE} \ + -environment-id=${ENVIRONMENT_ID} \ -organization-id=${ORGANIZATION_ID} \ -test-id=${TEST_ID} diff --git a/hack/create-account/README.md b/hack/create-account/README.md index 652ce3981..85deea1f7 100644 --- a/hack/create-account/README.md +++ b/hack/create-account/README.md @@ -7,7 +7,7 @@ go run ./hack/create-account create \ --service-token=full-path-to-service-token-file \ --email=email \ --role=role \ - --environment-namespace=environment-namespace \ + --environment-id=environment-id \ --is-admin(optional) \ --no-profile \ --no-gcp-trace-enabled diff --git a/hack/create-account/command.go b/hack/create-account/command.go index 4aa9895dd..ff991eec1 100644 --- a/hack/create-account/command.go +++ b/hack/create-account/command.go @@ -32,13 +32,13 @@ import ( type command struct { *kingpin.CmdClause - certPath *string - serviceTokenPath *string - webGatewayAddress *string - email *string - role *string - environmentNamespace *string - organizationID *string + certPath *string + serviceTokenPath *string + webGatewayAddress *string + email *string + role *string + environmentID *string + organizationID *string } func registerCommand(r cli.CommandRegistry, p cli.ParentCommand) *command { @@ -50,9 +50,9 @@ func registerCommand(r cli.CommandRegistry, p cli.ParentCommand) *command { webGatewayAddress: cmd.Flag("web-gateway", "Address of web-gateway.").Required().String(), email: cmd.Flag("email", "The email of an account.").Required().String(), role: cmd.Flag("role", "The role of an environment.").Required().Enum("VIEWER", "EDITOR"), - environmentNamespace: cmd.Flag( - "environment-namespace", - "The environment namespace for Datestore namespace", + environmentID: cmd.Flag( + "environment-id", + "The environment id for Datestore namespace", ).Required().String(), organizationID: cmd.Flag("organization-id", "The organization id").Required().String(), } @@ -74,7 +74,7 @@ func (c *command) Run(ctx context.Context, metrics metrics.Metrics, logger *zap. err = c.createAccount(ctx, client, accountproto.AccountV2_Role_Environment(role)) if err != nil { logger.Error("Failed to create account", zap.Error(err), - zap.String("environmentNamespace", *c.environmentNamespace)) + zap.String("environmentId", *c.environmentID)) return err } logger.Info("Account created") @@ -88,7 +88,7 @@ func (c *command) createAccount( ) error { envRoles := []*accountproto.AccountV2_EnvironmentRole{ { - EnvironmentId: *c.environmentNamespace, + EnvironmentId: *c.environmentID, Role: role, }, } diff --git a/hack/create-api-key/README.md b/hack/create-api-key/README.md index dd134f98e..5677bc004 100644 --- a/hack/create-api-key/README.md +++ b/hack/create-api-key/README.md @@ -8,7 +8,7 @@ go run ./hack/create-api-key create \ --name=key-name \ --role=key-role \ --output=full-path-to-output-file \ - --environment-namespace=environment-namespace \ + --environment-id=environment-id \ --no-profile \ --no-gcp-trace-enabled ``` diff --git a/hack/create-api-key/command.go b/hack/create-api-key/command.go index bd8ddf13d..e8d2755a2 100644 --- a/hack/create-api-key/command.go +++ b/hack/create-api-key/command.go @@ -32,13 +32,13 @@ import ( type command struct { *kingpin.CmdClause - certPath *string - serviceTokenPath *string - webGatewayAddress *string - name *string - role *string - output *string - environmentNamespace *string + certPath *string + serviceTokenPath *string + webGatewayAddress *string + name *string + role *string + output *string + environmentID *string } func registerCommand(r cli.CommandRegistry, p cli.ParentCommand) *command { @@ -52,9 +52,9 @@ func registerCommand(r cli.CommandRegistry, p cli.ParentCommand) *command { role: cmd.Flag( "role", "The role of key.").Default("SDK_CLIENT").Enum("UNKNOWN", "SDK_CLIENT", "SDK_SERVER"), output: cmd.Flag("output", "Path of file to write api key.").Required().String(), - environmentNamespace: cmd.Flag( - "environment-namespace", - "The environment namespace to store api key", + environmentID: cmd.Flag( + "environment-id", + "The environment id to store api key", ).Required().String(), } r.RegisterCommand(command) @@ -77,7 +77,7 @@ func (c *command) Run(ctx context.Context, metrics metrics.Metrics, logger *zap. Name: *c.name, Role: accountproto.APIKey_Role(role), }, - EnvironmentId: *c.environmentNamespace, + EnvironmentId: *c.environmentID, }) if err != nil { logger.Error("Failed to create api key", zap.Error(err)) diff --git a/pkg/account/api/account.go b/pkg/account/api/account.go index f4cf99246..6b608e055 100644 --- a/pkg/account/api/account.go +++ b/pkg/account/api/account.go @@ -217,7 +217,7 @@ func (s *AccountService) createAccountV2NoCommand( CreatedAt: account.CreatedAt, UpdatedAt: account.UpdatedAt, }, - storage.AdminEnvironmentNamespace, + storage.AdminEnvironmentID, account, nil, ) @@ -310,7 +310,7 @@ func (s *AccountService) changeExistedAccountV2EnvironmentRoles( Email: updated.Email, EnvironmentRoles: updated.EnvironmentRoles, }, - storage.AdminEnvironmentNamespace, + storage.AdminEnvironmentID, updated, account, ) diff --git a/pkg/api/api/metrics.go b/pkg/api/api/metrics.go index 8748c1d33..e1dc0c667 100644 --- a/pkg/api/api/metrics.go +++ b/pkg/api/api/metrics.go @@ -92,7 +92,7 @@ var ( // TODO: Remove project_id. }, []string{ "project_id", "project_url_code", - "environment_namespace", "environment_url_code", "tag", "evaluation_type", + "environment_id", "environment_url_code", "tag", "evaluation_type", }) getFeatureFlagsCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ @@ -103,7 +103,7 @@ var ( // TODO: Remove project_id. }, []string{ "project_id", "project_url_code", - "environment_namespace", "environment_url_code", "tag", "response_type", + "environment_id", "environment_url_code", "tag", "response_type", }) getSegmentUsersCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ @@ -113,7 +113,7 @@ var ( Help: "Total number of get segment users api requests", // TODO: Remove project_id. }, []string{ - "project_id", "project_url_code", "environment_namespace", "environment_url_code", + "project_id", "project_url_code", "environment_id", "environment_url_code", "source_id", "sdk_version", "response_type", }) requestTotal = prometheus.NewCounterVec( @@ -151,7 +151,7 @@ var ( Name: "sdk_get_evaluations_handling_seconds", Help: "Histogram of get evaluations response latency (seconds).", Buckets: prometheus.DefBuckets, - }, []string{"environment_namespace", "tag", "state"}) + }, []string{"environment_id", "tag", "state"}) // TODO: Remove after deleting api-gateway REST server sdkGetEvaluationsSizeHistogram = prometheus.NewHistogramVec( prometheus.HistogramOpts{ @@ -160,7 +160,7 @@ var ( Name: "sdk_get_evaluations_size", Help: "Histogram of get evaluations response size (byte).", Buckets: prometheus.DefBuckets, - }, []string{"environment_namespace", "tag", "state"}) + }, []string{"environment_id", "tag", "state"}) // TODO: Remove after deleting api-gateway REST server sdkTimeoutErrorCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ @@ -168,7 +168,7 @@ var ( Subsystem: "metrics_event", Name: "sdk_timeout_error_total", Help: "Total number of sdk timeout errors", - }, []string{"environment_namespace", "tag"}) + }, []string{"environment_id", "tag"}) // TODO: Remove after deleting api-gateway REST server sdkInternalErrorCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ @@ -176,7 +176,7 @@ var ( Subsystem: "metrics_event", Name: "sdk_internal_error_total", Help: "Total number of sdk internal errors", - }, []string{"environment_namespace", "tag"}) + }, []string{"environment_id", "tag"}) sdkLatencyHistogram = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Namespace: "bucketeer", @@ -184,7 +184,7 @@ var ( Name: "sdk_api_handling_seconds", Help: "Histogram of get evaluations response latency (seconds).", Buckets: prometheus.DefBuckets, - }, []string{"project_id", "environment_namespace", "tag", "api", "sdk_version", "source_id"}) + }, []string{"project_id", "environment_id", "tag", "api", "sdk_version", "source_id"}) sdkSizeHistogram = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Namespace: "bucketeer", @@ -192,14 +192,14 @@ var ( Name: "sdk_api_response_size", Help: "Histogram of get evaluations response size (byte).", Buckets: prometheus.DefBuckets, - }, []string{"project_id", "environment_namespace", "tag", "api", "sdk_version", "source_id"}) + }, []string{"project_id", "environment_id", "tag", "api", "sdk_version", "source_id"}) sdkErrorCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: "bucketeer", Subsystem: "metrics_event", Name: "sdk_api_error_total", Help: "Total number of sdk errors", - }, []string{"project_id", "environment_namespace", "tag", "error_type", "api", "sdk_version", "source_id"}) + }, []string{"project_id", "environment_id", "tag", "error_type", "api", "sdk_version", "source_id"}) ) func registerMetrics(r metrics.Registerer) { diff --git a/pkg/api/api/push.go b/pkg/api/api/push.go index 58e7d0c1e..d40cf5f1e 100644 --- a/pkg/api/api/push.go +++ b/pkg/api/api/push.go @@ -61,7 +61,7 @@ func (s *grpcGatewayService) ListPushes( if res == nil { s.logger.Error("Failed to list pushes: nil response", log.FieldsFromImcomingContext(ctx).AddFields( - zap.String("environment_namespace", envAPIKey.Environment.Id), + zap.String("environment_id", envAPIKey.Environment.Id), zap.String("search_keyword", req.SearchKeyword), )..., ) diff --git a/pkg/batch/jobs/rediscounter/redis_counter_deleter_test.go b/pkg/batch/jobs/rediscounter/redis_counter_deleter_test.go index 04a3337d4..dfe27266b 100644 --- a/pkg/batch/jobs/rediscounter/redis_counter_deleter_test.go +++ b/pkg/batch/jobs/rediscounter/redis_counter_deleter_test.go @@ -316,7 +316,7 @@ func TestFilterKeysOlderThanThirtyOneDays(t *testing.T) { expectedError: errSubmatchStringNotFound, }, { - desc: "success: using empty environment namespace", + desc: "success: using empty environment id", inputEnvNamespace: "", inputKind: "uc", inputKeys: []string{ diff --git a/pkg/cache/v3/environment_api_key.go b/pkg/cache/v3/environment_api_key.go index 6881e5079..c21c4b246 100644 --- a/pkg/cache/v3/environment_api_key.go +++ b/pkg/cache/v3/environment_api_key.go @@ -70,6 +70,6 @@ func (c *environmentAPIKeyCache) Put(environmentAPIKey *accountproto.Environment } func (c *environmentAPIKeyCache) key(id string) string { - // always use AdminEnvironmentNamespace because we'd like to get APIKey and environment_id only by id + // always use AdminEnvironmentId because we'd like to get APIKey and environment_id only by id return cache.MakeKey(environmentAPIKeyKind, id, storage.AdminEnvironmentID) } diff --git a/pkg/role/role.go b/pkg/role/role.go index 77d02f6ad..ff83201f2 100644 --- a/pkg/role/role.go +++ b/pkg/role/role.go @@ -81,7 +81,7 @@ func CheckEnvironmentRole( if token.IsSystemAdmin { return checkRole(token.Email, token.Name, accountproto.AccountV2_Role_Environment_EDITOR, requiredRole, true) } - // get account for the environment namespace + // get account for the environment id account, err := getAccountFunc(token.Email) if err != nil { if code := status.Code(err); code == codes.NotFound { diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 1817b5ab5..a7d70d184 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -23,8 +23,7 @@ import ( ) const ( - AdminEnvironmentNamespace = "" - AdminEnvironmentID = "" + AdminEnvironmentID = "" OrderDirectionAsc OrderDirection = 0 OrderDirectionDesc OrderDirection = 1 diff --git a/test/e2e/account/account_test.go b/test/e2e/account/account_test.go index ed734bf14..25f3c83f7 100644 --- a/test/e2e/account/account_test.go +++ b/test/e2e/account/account_test.go @@ -43,18 +43,18 @@ const ( ) var ( - webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") - webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") - webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") - apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") - apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") - gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") - gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") - gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") - serviceTokenPath = flag.String("service-token", "", "Service token path") - environmentNamespace = flag.String("environment-namespace", "", "Environment namespace") - organizationID = flag.String("organization-id", "", "Organization ID") - testID = flag.String("test-id", "", "test ID") + webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") + webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") + webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") + apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") + apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") + gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") + gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") + gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") + serviceTokenPath = flag.String("service-token", "", "Service token path") + environmentID = flag.String("environment-id", "", "Environment id") + organizationID = flag.String("organization-id", "", "Organization ID") + testID = flag.String("test-id", "", "test ID") ) func TestGetAccount(t *testing.T) { diff --git a/test/e2e/autoops/auto_ops_test.go b/test/e2e/autoops/auto_ops_test.go index ff3dfd41d..c1e467c65 100644 --- a/test/e2e/autoops/auto_ops_test.go +++ b/test/e2e/autoops/auto_ops_test.go @@ -64,18 +64,18 @@ const ( ) var ( - webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") - webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") - webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") - apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") - apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") - gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") - gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") - gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") - serviceTokenPath = flag.String("service-token", "", "Service token path") - environmentNamespace = flag.String("environment-namespace", "", "Environment namespace") - organizationID = flag.String("organization-id", "", "Organization ID") - testID = flag.String("test-id", "", "test ID") + webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") + webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") + webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") + apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") + apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") + gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") + gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") + gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") + serviceTokenPath = flag.String("service-token", "", "Service token path") + environmentID = flag.String("environment-id", "", "Environment id") + organizationID = flag.String("organization-id", "", "Organization ID") + testID = flag.String("test-id", "", "test ID") ) type eventType int @@ -300,7 +300,7 @@ func TestDeleteAutoOpsRule(t *testing.T) { } deleteAutoOpsRules(t, autoOpsClient, autoOpsRules[0].Id) resp, err := autoOpsClient.GetAutoOpsRule(ctx, &autoopsproto.GetAutoOpsRuleRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: autoOpsRules[0].Id, }) if resp != nil { @@ -337,7 +337,7 @@ func TestUpdateAutoOpsRule(t *testing.T) { } updateAutoOpsRules(t, autoOpsClient, autoOpsRules[0].Id, &addClause) resp, err := autoOpsClient.GetAutoOpsRule(ctx, &autoopsproto.GetAutoOpsRuleRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: autoOpsRules[0].Id, }) if resp == nil { @@ -383,7 +383,7 @@ func TestExecuteAutoOpsRule(t *testing.T) { t.Fatal("not enough rules") } _, err := autoOpsClient.ExecuteAutoOps(ctx, &autoopsproto.ExecuteAutoOpsRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: autoOpsRules[0].Id, ExecuteAutoOpsRuleCommand: &autoopsproto.ExecuteAutoOpsRuleCommand{ ClauseId: autoOpsRules[0].Clauses[0].Id, @@ -422,7 +422,7 @@ func TestExecuteAutoOpsRuleForMultiSchedule(t *testing.T) { t.Fatal("not enough rules") } _, err := autoOpsClient.ExecuteAutoOps(ctx, &autoopsproto.ExecuteAutoOpsRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: autoOpsRules[0].Id, ExecuteAutoOpsRuleCommand: &autoopsproto.ExecuteAutoOpsRuleCommand{ ClauseId: autoOpsRules[0].Clauses[0].Id, @@ -768,7 +768,7 @@ func createGoal(ctx context.Context, t *testing.T, client experimentclient.Clien } _, err := client.CreateGoal(ctx, &experimentproto.CreateGoalRequest{ Command: cmd, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -829,7 +829,7 @@ func createAutoOpsRule( DatetimeClauses: dcs, } _, err := client.CreateAutoOpsRule(ctx, &autoopsproto.CreateAutoOpsRuleRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Command: cmd, }) if err != nil { @@ -899,7 +899,7 @@ func createFeature(ctx context.Context, t *testing.T, client featureclient.Clien cmd := newCreateFeatureCommand(featureID) createReq := &featureproto.CreateFeatureRequest{ Command: cmd, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } if _, err := client.CreateFeature(ctx, createReq); err != nil { t.Fatal(err) @@ -912,7 +912,7 @@ func createDisabledFeature(ctx context.Context, t *testing.T, client featureclie cmd := newCreateFeatureCommand(featureID) createReq := &featureproto.CreateFeatureRequest{ Command: cmd, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } if _, err := client.CreateFeature(ctx, createReq); err != nil { t.Fatal(err) @@ -923,7 +923,7 @@ func getFeature(t *testing.T, client featureclient.Client, featureID string) *fe t.Helper() getReq := &featureproto.GetFeatureRequest{ Id: featureID, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -985,7 +985,7 @@ func enableFeature(t *testing.T, featureID string, client featureclient.Client) enableReq := &featureproto.EnableFeatureRequest{ Id: featureID, Command: &featureproto.EnableFeatureCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -999,7 +999,7 @@ func listAutoOpsRulesByFeatureID(t *testing.T, client autoopsclient.Client, feat ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() resp, err := client.ListAutoOpsRules(ctx, &autoopsproto.ListAutoOpsRulesRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, PageSize: int64(500), FeatureIds: []string{featureID}, }) @@ -1016,7 +1016,7 @@ func getAutoOpsRules(t *testing.T, id string) *autoopsproto.AutoOpsRule { c := newAutoOpsClient(t) defer c.Close() resp, err := c.GetAutoOpsRule(ctx, &autoopsproto.GetAutoOpsRuleRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, }) if err != nil { @@ -1030,7 +1030,7 @@ func deleteAutoOpsRules(t *testing.T, client autoopsclient.Client, id string) { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() _, err := client.DeleteAutoOpsRule(ctx, &autoopsproto.DeleteAutoOpsRuleRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, Command: &autoopsproto.DeleteAutoOpsRuleCommand{}, }) @@ -1058,7 +1058,7 @@ func TestStopAutoOpsRule(t *testing.T) { } stopAutoOpsRule(t, autoOpsClient, autoOpsRules[0].Id) resp, err := autoOpsClient.GetAutoOpsRule(ctx, &autoopsproto.GetAutoOpsRuleRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: autoOpsRules[0].Id, }) if resp == nil { @@ -1075,7 +1075,7 @@ func stopAutoOpsRule(t *testing.T, client autoopsclient.Client, id string) { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() _, err := client.StopAutoOpsRule(ctx, &autoopsproto.StopAutoOpsRuleRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, Command: &autoopsproto.StopAutoOpsRuleCommand{}, }) @@ -1089,7 +1089,7 @@ func updateAutoOpsRules(t *testing.T, client autoopsclient.Client, id string, da ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() _, err := client.UpdateAutoOpsRule(ctx, &autoopsproto.UpdateAutoOpsRuleRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, AddDatetimeClauseCommands: []*autoopsproto.AddDatetimeClauseCommand{ {DatetimeClause: dateClause}, diff --git a/test/e2e/autoops/progressive_rollout_test.go b/test/e2e/autoops/progressive_rollout_test.go index 03cc970ef..3f97148b2 100644 --- a/test/e2e/autoops/progressive_rollout_test.go +++ b/test/e2e/autoops/progressive_rollout_test.go @@ -157,7 +157,7 @@ func TestStopProgressiveRollout(t *testing.T) { } stopProgressiveRollout(t, autoOpsClient, progressiveRollouts[0].Id) resp, err := autoOpsClient.GetProgressiveRollout(ctx, &autoopsproto.GetProgressiveRolloutRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: progressiveRollouts[0].Id, }) assert.NoError(t, err) @@ -196,7 +196,7 @@ func TestDeleteProgressiveRollout(t *testing.T) { } deleteProgressiveRollout(t, autoOpsClient, progressiveRollouts[0].Id) resp, err := autoOpsClient.GetProgressiveRollout(ctx, &autoopsproto.GetProgressiveRolloutRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: progressiveRollouts[0].Id, }) if resp != nil { @@ -240,7 +240,7 @@ func TestExecuteProgressiveRollout(t *testing.T) { } clause := unmarshalProgressiveRolloutManualClause(t, progressiveRollouts[0].Clause) _, err := autoOpsClient.ExecuteProgressiveRollout(ctx, &autoopsproto.ExecuteProgressiveRolloutRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: progressiveRollouts[0].Id, ChangeProgressiveRolloutTriggeredAtCommand: &autoopsproto.ChangeProgressiveRolloutScheduleTriggeredAtCommand{ ScheduleId: clause.Schedules[0].ScheduleId, @@ -374,7 +374,7 @@ func createProgressiveRollout( ProgressiveRolloutTemplateScheduleClause: template, } _, err := client.CreateProgressiveRollout(ctx, &autoopsproto.CreateProgressiveRolloutRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Command: cmd, }) if err != nil { @@ -387,7 +387,7 @@ func listProgressiveRollouts(t *testing.T, client autoopsclient.Client, featureI ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() resp, err := client.ListProgressiveRollouts(ctx, &autoopsproto.ListProgressiveRolloutsRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, PageSize: 0, FeatureIds: []string{featureID}, }) @@ -430,7 +430,7 @@ func getProgressiveRollout(t *testing.T, id string) *autoopsproto.ProgressiveRol c := newAutoOpsClient(t) defer c.Close() resp, err := c.GetProgressiveRollout(ctx, &autoopsproto.GetProgressiveRolloutRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, }) if err != nil { @@ -444,7 +444,7 @@ func stopProgressiveRollout(t *testing.T, client autoopsclient.Client, id string ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() _, err := client.StopProgressiveRollout(ctx, &autoopsproto.StopProgressiveRolloutRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, Command: &autoopsproto.StopProgressiveRolloutCommand{ StoppedBy: autoopsproto.ProgressiveRollout_USER, @@ -460,7 +460,7 @@ func deleteProgressiveRollout(t *testing.T, client autoopsclient.Client, id stri ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() _, err := client.DeleteProgressiveRollout(ctx, &autoopsproto.DeleteProgressiveRolloutRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, Command: &autoopsproto.DeleteProgressiveRolloutCommand{}, }) diff --git a/test/e2e/environment/environment_v2_test.go b/test/e2e/environment/environment_v2_test.go index beaa89e28..cd8b28786 100644 --- a/test/e2e/environment/environment_v2_test.go +++ b/test/e2e/environment/environment_v2_test.go @@ -33,18 +33,18 @@ const ( var ( // FIXME: To avoid compiling the test many times, webGatewayAddr, webGatewayPort & apiKey has been also added here to prevent from getting: "flag provided but not defined" error during the test. These 3 are being use in the Gateway test - webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") - webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") - webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") - apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") - apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") - gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") - gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") - gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") - serviceTokenPath = flag.String("service-token", "", "Service token path") - environmentNamespace = flag.String("environment-namespace", "", "Environment namespace") - organizationID = flag.String("organization-id", "", "Organization ID") - testID = flag.String("test-id", "", "test ID") + webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") + webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") + webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") + apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") + apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") + gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") + gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") + gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") + serviceTokenPath = flag.String("service-token", "", "Service token path") + environmentID = flag.String("environment-id", "", "Environment id") + organizationID = flag.String("organization-id", "", "Organization ID") + testID = flag.String("test-id", "", "test ID") ) const ( @@ -135,10 +135,10 @@ func TestUpdateEnvironmentV2(t *testing.T) { func getEnvironmentID(t *testing.T) string { t.Helper() - if *environmentNamespace == "" { + if *environmentID == "" { return "production" } - return *environmentNamespace + return *environmentID } func newEnvironmentClient(t *testing.T) environmentclient.Client { diff --git a/test/e2e/eventcounter/eventcounter_test.go b/test/e2e/eventcounter/eventcounter_test.go index e84ff2753..74fc09791 100644 --- a/test/e2e/eventcounter/eventcounter_test.go +++ b/test/e2e/eventcounter/eventcounter_test.go @@ -61,19 +61,19 @@ const ( const defaultVariationID = "default" var ( - webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") - webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") - webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") - apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") - apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") - gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") - gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") - gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") - serviceTokenPath = flag.String("service-token", "", "Service token path") - environmentNamespace = flag.String("environment-namespace", "", "Environment namespace") - organizationID = flag.String("organization-id", "", "Organization ID") - testID = flag.String("test-id", "", "test ID") - compareFloatOpt = cmpopts.EquateApprox(0, 0.0001) + webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") + webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") + webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") + apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") + apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") + gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") + gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") + gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") + serviceTokenPath = flag.String("service-token", "", "Service token path") + environmentID = flag.String("environment-id", "", "Environment id") + organizationID = flag.String("organization-id", "", "Organization ID") + testID = flag.String("test-id", "", "test ID") + compareFloatOpt = cmpopts.EquateApprox(0, 0.0001) ) func TestGrpcExperimentGoalCount(t *testing.T) { @@ -1603,7 +1603,7 @@ func createGoals(ctx context.Context, t *testing.T, client experimentclient.Clie } _, err := client.CreateGoal(ctx, &experimentproto.CreateGoalRequest{ Command: cmd, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -1633,13 +1633,13 @@ func createExperimentWithMultiGoals( } resp, err := client.CreateExperiment(ctx, &experimentproto.CreateExperimentRequest{ Command: cmd, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) } _, err = client.StartExperiment(ctx, &experimentproto.StartExperimentRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: resp.Experiment.Id, Command: &experimentproto.StartExperimentCommand{}, }) @@ -2055,7 +2055,7 @@ func createFeature( cmd := newCreateFeatureCommand(featureID, []string{variationA, variationB}) createReq := &featureproto.CreateFeatureRequest{ Command: cmd, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -2073,7 +2073,7 @@ func addTag(t *testing.T, tag string, featureID string, client featureclient.Cli AddTagCommands: []*featureproto.AddTagCommand{ {Tag: tag}, }, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -2087,7 +2087,7 @@ func enableFeature(t *testing.T, featureID string, client featureclient.Client) enableReq := &featureproto.EnableFeatureRequest{ Id: featureID, Command: &featureproto.EnableFeatureCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -2111,7 +2111,7 @@ func addFeatureIndividualTargeting(t *testing.T, featureID, userID, variationID Command: cmd, }, }, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, From: featureproto.UpdateFeatureTargetingRequest_USER, } ctx, cancel := context.WithTimeout(context.Background(), timeout) @@ -2157,7 +2157,7 @@ func getExperiment(t *testing.T, c experimentclient.Client, id string) (*experim ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() req := &experimentproto.GetExperimentRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, } var response *experimentproto.GetExperimentResponse @@ -2187,7 +2187,7 @@ func getExperimentResult(t *testing.T, c ecclient.Client, experimentID string) ( defer cancel() req := &ecproto.GetExperimentResultRequest{ ExperimentId: experimentID, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } var response *ecproto.GetExperimentResultResponse var err error @@ -2219,7 +2219,7 @@ func getExperimentEvaluationCount( defer cancel() now := time.Now() req := &ecproto.GetExperimentEvaluationCountRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, StartAt: now.Add(-30 * 24 * time.Hour).Unix(), EndAt: now.Unix(), FeatureId: featureID, @@ -2256,7 +2256,7 @@ func getExperimentGoalCount( defer cancel() now := time.Now() req := &ecproto.GetExperimentGoalCountRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, StartAt: now.Add(-30 * 24 * time.Hour).Unix(), EndAt: now.Unix(), GoalId: goalID, @@ -2290,7 +2290,7 @@ func getFeature(t *testing.T, client featureclient.Client, featureID string) (*f t.Helper() getReq := &featureproto.GetFeatureRequest{ Id: featureID, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -2322,7 +2322,7 @@ func getEvaluationTimeseriesCount( ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() req := &ecproto.GetEvaluationTimeseriesCountRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, FeatureId: featureID, TimeRange: timeRange, } diff --git a/test/e2e/experiment/experiment_test.go b/test/e2e/experiment/experiment_test.go index 98f062355..926fbe44c 100644 --- a/test/e2e/experiment/experiment_test.go +++ b/test/e2e/experiment/experiment_test.go @@ -41,18 +41,18 @@ const ( var ( // FIXME: To avoid compiling the test many times, webGatewayAddr, webGatewayPort & apiKey has been also added here to prevent from getting: "flag provided but not defined" error during the test. These 3 are being use in the Gateway test - webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") - webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") - webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") - apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") - apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") - gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") - gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") - gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") - serviceTokenPath = flag.String("service-token", "", "Service token path") - environmentNamespace = flag.String("environment-namespace", "", "Environment namespace") - organizationID = flag.String("organization-id", "", "Organization ID") - testID = flag.String("test-id", "", "test ID") + webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") + webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") + webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") + apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") + apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") + gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") + gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") + gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") + serviceTokenPath = flag.String("service-token", "", "Service token path") + environmentID = flag.String("environment-id", "", "Environment id") + organizationID = flag.String("organization-id", "", "Organization ID") + testID = flag.String("test-id", "", "test ID") ) func TestCreateAndGetExperiment(t *testing.T) { @@ -70,7 +70,7 @@ func TestCreateAndGetExperiment(t *testing.T) { expected := createExperimentWithMultiGoals(ctx, t, c, featureID, feature.Variations[0].Id, goalIDs, startAt, stopAt) getResp, err := c.GetExperiment(ctx, &experimentproto.GetExperimentRequest{ Id: expected.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -98,7 +98,7 @@ func TestListExperiments(t *testing.T) { for _, e := range expectedExps { getResp, err := c.GetExperiment(ctx, &experimentproto.GetExperimentRequest{ Id: e.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -124,13 +124,13 @@ func TestStopExperiment(t *testing.T) { if _, err := c.StopExperiment(ctx, &experimentproto.StopExperimentRequest{ Id: e.Id, Command: &experimentproto.StopExperimentCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }); err != nil { t.Fatal(err) } getResp, err := c.GetExperiment(ctx, &experimentproto.GetExperimentRequest{ Id: e.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -156,13 +156,13 @@ func TestArchiveExperiment(t *testing.T) { if _, err := c.ArchiveExperiment(ctx, &experimentproto.ArchiveExperimentRequest{ Id: e.Id, Command: &experimentproto.ArchiveExperimentCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }); err != nil { t.Fatal(err) } getResp, err := c.GetExperiment(ctx, &experimentproto.GetExperimentRequest{ Id: e.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -188,13 +188,13 @@ func TestDeleteExperiment(t *testing.T) { if _, err := c.DeleteExperiment(ctx, &experimentproto.DeleteExperimentRequest{ Id: e.Id, Command: &experimentproto.DeleteExperimentCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }); err != nil { t.Fatal(err) } getResp, err := c.GetExperiment(ctx, &experimentproto.GetExperimentRequest{ Id: e.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -223,13 +223,13 @@ func TestUpdateExperiment(t *testing.T) { if _, err := c.UpdateExperiment(ctx, &experimentproto.UpdateExperimentRequest{ Id: e.Id, ChangeExperimentPeriodCommand: &experimentproto.ChangeExperimentPeriodCommand{StartAt: startAt.Unix(), StopAt: stopAt.Unix()}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }); err != nil { t.Fatal(err) } getResp, err := c.GetExperiment(ctx, &experimentproto.GetExperimentRequest{ Id: e.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -253,7 +253,7 @@ func TestCreateAndGetGoal(t *testing.T) { expectedDescription := fmt.Sprintf("%s-goal-description", goalID) getResp, err := c.GetGoal(ctx, &experimentproto.GetGoalRequest{ Id: goalID, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -283,7 +283,7 @@ func TestListGoalsCursor(t *testing.T) { expectedSize := 1 listResp, err := c.ListGoals(ctx, &experimentproto.ListGoalsRequest{ PageSize: int64(expectedSize), - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -298,7 +298,7 @@ func TestListGoalsCursor(t *testing.T) { listResp, err = c.ListGoals(ctx, &experimentproto.ListGoalsRequest{ PageSize: int64(expectedSize), Cursor: listResp.Cursor, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -319,7 +319,7 @@ func TestListGoalsPageSize(t *testing.T) { expectedSize := 3 listResp, err := c.ListGoals(ctx, &experimentproto.ListGoalsRequest{ PageSize: int64(expectedSize), - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -343,14 +343,14 @@ func TestUpdateGoal(t *testing.T) { Id: goalID, RenameCommand: &experimentproto.RenameGoalCommand{Name: expectedName}, ChangeDescriptionCommand: &experimentproto.ChangeDescriptionGoalCommand{Description: expectedDescription}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) } getResp, err := c.GetGoal(ctx, &experimentproto.GetGoalRequest{ Id: goalID, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -380,14 +380,14 @@ func TestArchiveGoal(t *testing.T) { _, err := c.ArchiveGoal(ctx, &experimentproto.ArchiveGoalRequest{ Id: goalID, Command: &experimentproto.ArchiveGoalCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) } getResp, err := c.GetGoal(ctx, &experimentproto.GetGoalRequest{ Id: goalID, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -407,14 +407,14 @@ func TestDeleteGoal(t *testing.T) { _, err := c.DeleteGoal(ctx, &experimentproto.DeleteGoalRequest{ Id: goalID, Command: &experimentproto.DeleteGoalCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) } getResp, err := c.GetGoal(ctx, &experimentproto.GetGoalRequest{ Id: goalID, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -439,7 +439,7 @@ func TestStatusUpdateFromWaitingToRunning(t *testing.T) { expected := createExperimentWithMultiGoals(ctx, t, c, featureID, feature.Variations[0].Id, goalIDs, startAt, stopAt) resp, err := c.GetExperiment(ctx, &experimentproto.GetExperimentRequest{ Id: expected.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -450,7 +450,7 @@ func TestStatusUpdateFromWaitingToRunning(t *testing.T) { for i := 0; i < retryTimes; i++ { resp, err = c.GetExperiment(ctx, &experimentproto.GetExperimentRequest{ Id: expected.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -481,7 +481,7 @@ func TestStatusUpdateFromRunningToStopped(t *testing.T) { expected := createExperimentWithMultiGoals(ctx, t, c, featureID, feature.Variations[0].Id, goalIDs, startAt, stopAt) resp, err := c.GetExperiment(ctx, &experimentproto.GetExperimentRequest{ Id: expected.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -492,13 +492,13 @@ func TestStatusUpdateFromRunningToStopped(t *testing.T) { if _, err = c.StartExperiment(ctx, &experimentproto.StartExperimentRequest{ Id: expected.Id, Command: &experimentproto.StartExperimentCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }); err != nil { t.Fatal(err) } resp, err = c.GetExperiment(ctx, &experimentproto.GetExperimentRequest{ Id: expected.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if resp.Experiment.Status != experimentproto.Experiment_RUNNING { t.Fatalf("Experiment status is not running. actual: %d", resp.Experiment.Status) @@ -506,7 +506,7 @@ func TestStatusUpdateFromRunningToStopped(t *testing.T) { for i := 0; i < retryTimes; i++ { resp, err = c.GetExperiment(ctx, &experimentproto.GetExperimentRequest{ Id: expected.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -537,7 +537,7 @@ func TestStatusUpdateFromWaitingToStopped(t *testing.T) { expected := createExperimentWithMultiGoals(ctx, t, c, featureID, feature.Variations[0].Id, goalIDs, startAt, stopAt) resp, err := c.GetExperiment(ctx, &experimentproto.GetExperimentRequest{ Id: expected.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -548,7 +548,7 @@ func TestStatusUpdateFromWaitingToStopped(t *testing.T) { for i := 0; i < retryTimes; i++ { resp, err = c.GetExperiment(ctx, &experimentproto.GetExperimentRequest{ Id: expected.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -573,7 +573,7 @@ func createGoal(ctx context.Context, t *testing.T, client experimentclient.Clien } _, err := client.CreateGoal(ctx, &experimentproto.CreateGoalRequest{ Command: cmd, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -624,7 +624,7 @@ func createExperimentWithMultiGoals( } resp, err := client.CreateExperiment(ctx, &experimentproto.CreateExperimentRequest{ Command: cmd, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal(err) @@ -666,7 +666,7 @@ func getFeature(ctx context.Context, t *testing.T, featureID string) *featurepro defer client.Close() req := &featureproto.GetFeatureRequest{ Id: featureID, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } resp, err := client.GetFeature(ctx, req) if err != nil { @@ -682,7 +682,7 @@ func createFeature(ctx context.Context, t *testing.T, featureID string) { cmd := newCreateFeatureCommand(featureID) createReq := &featureproto.CreateFeatureRequest{ Command: cmd, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } if _, err := client.CreateFeature(ctx, createReq); err != nil { t.Fatal(err) @@ -741,7 +741,7 @@ func enableFeature(t *testing.T, featureID string, client featureclient.Client) enableReq := &featureproto.EnableFeatureRequest{ Id: featureID, Command: &featureproto.EnableFeatureCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() diff --git a/test/e2e/feature/feature_flag_trigger_test.go b/test/e2e/feature/feature_flag_trigger_test.go index 1a6da9487..cc7373fa4 100644 --- a/test/e2e/feature/feature_flag_trigger_test.go +++ b/test/e2e/feature/feature_flag_trigger_test.go @@ -77,7 +77,7 @@ func TestUpdateFlagTrigger(t *testing.T) { // Update flag trigger updateFlagTriggerReq := &featureproto.UpdateFlagTriggerRequest{ Id: createResp.FlagTrigger.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, ChangeFlagTriggerDescriptionCommand: &featureproto.ChangeFlagTriggerDescriptionCommand{ Description: newTriggerDescription(t), }, @@ -89,7 +89,7 @@ func TestUpdateFlagTrigger(t *testing.T) { // Get flag trigger getFlagTriggerReq := &featureproto.GetFlagTriggerRequest{ Id: createResp.FlagTrigger.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } resp := getFeatureFlagTrigger(t, client, getFlagTriggerReq) if resp.FlagTrigger.Description != updateFlagTriggerReq.ChangeFlagTriggerDescriptionCommand.Description { @@ -113,7 +113,7 @@ func TestDisableEnableFlagTrigger(t *testing.T) { // Disable flag trigger disableFlagTriggerReq := &featureproto.DisableFlagTriggerRequest{ Id: createResp.FlagTrigger.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, DisableFlagTriggerCommand: &featureproto.DisableFlagTriggerCommand{}, } _, err := client.DisableFlagTrigger(context.Background(), disableFlagTriggerReq) @@ -122,7 +122,7 @@ func TestDisableEnableFlagTrigger(t *testing.T) { } getFlagTriggerReq := &featureproto.GetFlagTriggerRequest{ Id: createResp.FlagTrigger.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } // Get flag trigger resp := getFeatureFlagTrigger(t, client, getFlagTriggerReq) @@ -132,7 +132,7 @@ func TestDisableEnableFlagTrigger(t *testing.T) { // Enable flag trigger enableFlagTriggerReq := &featureproto.EnableFlagTriggerRequest{ Id: createResp.FlagTrigger.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, EnableFlagTriggerCommand: &featureproto.EnableFlagTriggerCommand{}, } _, err = client.EnableFlagTrigger(context.Background(), enableFlagTriggerReq) @@ -162,7 +162,7 @@ func TestResetFlagTrigger(t *testing.T) { // Reset flag trigger resetFlagTriggerReq := &featureproto.ResetFlagTriggerRequest{ Id: createResp.FlagTrigger.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, ResetFlagTriggerCommand: &featureproto.ResetFlagTriggerCommand{}, } resetResp, err := client.ResetFlagTrigger(context.Background(), resetFlagTriggerReq) @@ -190,7 +190,7 @@ func TestDeleteFlagTrigger(t *testing.T) { // Delete flag trigger deleteFlagTriggerReq := &featureproto.DeleteFlagTriggerRequest{ Id: createResp.FlagTrigger.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, DeleteFlagTriggerCommand: &featureproto.DeleteFlagTriggerCommand{}, } _, err := client.DeleteFlagTrigger(context.Background(), deleteFlagTriggerReq) @@ -200,7 +200,7 @@ func TestDeleteFlagTrigger(t *testing.T) { // Get flag trigger getFlagTriggerReq := &featureproto.GetFlagTriggerRequest{ Id: createResp.FlagTrigger.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } _, err = client.GetFlagTrigger(context.Background(), getFlagTriggerReq) if err == nil { @@ -216,7 +216,7 @@ func TestListFlagTriggers(t *testing.T) { createFeature(t, client, command) // Create flag triggers trigger1, err := client.CreateFlagTrigger(context.Background(), &featureproto.CreateFlagTriggerRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, CreateFlagTriggerCommand: newCreateFlagTriggerCmd( command.Id, newTriggerDescription(t), @@ -228,7 +228,7 @@ func TestListFlagTriggers(t *testing.T) { } time.Sleep(1 * time.Second) trigger2, err := client.CreateFlagTrigger(context.Background(), &featureproto.CreateFlagTriggerRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, CreateFlagTriggerCommand: newCreateFlagTriggerCmd( command.Id, newTriggerDescription(t), @@ -241,7 +241,7 @@ func TestListFlagTriggers(t *testing.T) { // List flag triggers listFlagTriggersReq := &featureproto.ListFlagTriggersRequest{ FeatureId: command.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Cursor: "0", PageSize: 10, OrderBy: featureproto.ListFlagTriggersRequest_CREATED_AT, @@ -284,7 +284,7 @@ func TestFeatureFlagWebhook(t *testing.T) { createFeature(t, client, command) // Create Enable flag triggers enableTrigger, err := client.CreateFlagTrigger(context.Background(), &featureproto.CreateFlagTriggerRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, CreateFlagTriggerCommand: newCreateFlagTriggerCmd( command.Id, newTriggerDescription(t), @@ -309,7 +309,7 @@ func TestFeatureFlagWebhook(t *testing.T) { } enabledTrigger := getFeatureFlagTrigger(t, client, &featureproto.GetFlagTriggerRequest{ Id: enableTrigger.FlagTrigger.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if enabledTrigger.FlagTrigger.TriggerCount != 1 { t.Fatalf("unexpected trigger times: %d", enabledTrigger.FlagTrigger.TriggerCount) @@ -319,7 +319,7 @@ func TestFeatureFlagWebhook(t *testing.T) { } // Create Disable flag triggers disableTrigger, err := client.CreateFlagTrigger(context.Background(), &featureproto.CreateFlagTriggerRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, CreateFlagTriggerCommand: newCreateFlagTriggerCmd( command.Id, newTriggerDescription(t), @@ -344,7 +344,7 @@ func TestFeatureFlagWebhook(t *testing.T) { } disabledTrigger := getFeatureFlagTrigger(t, client, &featureproto.GetFlagTriggerRequest{ Id: disableTrigger.FlagTrigger.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if disabledTrigger.FlagTrigger.TriggerCount != 1 { t.Fatalf("unexpected trigger times: %d", disabledTrigger.FlagTrigger.TriggerCount) @@ -407,7 +407,7 @@ func createFeatureFlagTrigger( ) *featureproto.CreateFlagTriggerResponse { t.Helper() resp, err := client.CreateFlagTrigger(context.Background(), &featureproto.CreateFlagTriggerRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, CreateFlagTriggerCommand: cmd, }) if err != nil { diff --git a/test/e2e/feature/feature_test.go b/test/e2e/feature/feature_test.go index a9257c3cb..cc26fd29e 100644 --- a/test/e2e/feature/feature_test.go +++ b/test/e2e/feature/feature_test.go @@ -47,18 +47,18 @@ const ( var ( // FIXME: To avoid compiling the test many times, webGatewayAddr, webGatewayPort & apiKey has been also added here to prevent from getting: "flag provided but not defined" error during the test. These 3 are being use in the Gateway test - webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") - webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") - webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") - apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") - apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") - gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") - gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") - gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") - serviceTokenPath = flag.String("service-token", "", "Service token path") - environmentNamespace = flag.String("environment-namespace", "", "Environment namespace") - testID = flag.String("test-id", "", "test ID") - organizationID = flag.String("organization-id", "", "Organization ID") + webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") + webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") + webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") + apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") + apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") + gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") + gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") + gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") + serviceTokenPath = flag.String("service-token", "", "Service token path") + environmentID = flag.String("environment-id", "", "Environment id") + testID = flag.String("test-id", "", "test ID") + organizationID = flag.String("organization-id", "", "Organization ID") tags = []string{"e2e-test-tag-1", "e2e-test-tag-2", "e2e-test-tag-3"} ) @@ -108,7 +108,7 @@ func TestArchiveFeature(t *testing.T) { req := &feature.ArchiveFeatureRequest{ Id: featureID, Command: &feature.ArchiveFeatureCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -135,7 +135,7 @@ func TestUnarchiveFeature(t *testing.T) { req := &feature.ArchiveFeatureRequest{ Id: featureID, Command: &feature.ArchiveFeatureCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } if _, err := client.ArchiveFeature(ctx, req); err != nil { t.Fatal(err) @@ -143,7 +143,7 @@ func TestUnarchiveFeature(t *testing.T) { reqUnarchive := &feature.UnarchiveFeatureRequest{ Id: featureID, Command: &feature.UnarchiveFeatureCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } if _, err := client.UnarchiveFeature(ctx, reqUnarchive); err != nil { t.Fatal(err) @@ -166,7 +166,7 @@ func TestDeleteFeature(t *testing.T) { deleteReq := &feature.DeleteFeatureRequest{ Id: featureID, Command: &feature.DeleteFeatureCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -310,7 +310,7 @@ func TestDisableFeature(t *testing.T) { disableReq := &feature.DisableFeatureRequest{ Id: cmd.Id, Command: &feature.DisableFeatureCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } if _, err := client.DisableFeature(ctx, disableReq); err != nil { t.Fatal(err) @@ -387,7 +387,7 @@ func TestListArchivedFeatures(t *testing.T) { req := &feature.ArchiveFeatureRequest{ Id: featureID, Command: &feature.ArchiveFeatureCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -397,7 +397,7 @@ func TestListArchivedFeatures(t *testing.T) { listReq := &feature.ListFeaturesRequest{ PageSize: size, Archived: &wrappers.BoolValue{Value: true}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } response, err := client.ListFeatures(ctx, listReq) if err != nil { @@ -416,7 +416,7 @@ func TestListFeaturesPageSize(t *testing.T) { createRandomIDFeatures(t, 2, client) listReq := &feature.ListFeaturesRequest{ PageSize: size, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -437,7 +437,7 @@ func TestListFeaturesCursor(t *testing.T) { size := int64(1) listReq := &feature.ListFeaturesRequest{ PageSize: size, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -452,7 +452,7 @@ func TestListFeaturesCursor(t *testing.T) { listReq = &feature.ListFeaturesRequest{ PageSize: size, Cursor: response.Cursor, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } response, err = client.ListFeatures(ctx, listReq) if err != nil { @@ -488,7 +488,7 @@ func TestListFeaturesOrderByName(t *testing.T) { PageSize: size, OrderBy: feature.ListFeaturesRequest_NAME, OrderDirection: tc.orderDirection, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -531,7 +531,7 @@ func TestListFeaturesOrderByCreatedAt(t *testing.T) { PageSize: size, OrderBy: feature.ListFeaturesRequest_CREATED_AT, OrderDirection: tc.orderDirection, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -574,7 +574,7 @@ func TestListFeaturesOrderByUpdatedAt(t *testing.T) { PageSize: size, OrderBy: feature.ListFeaturesRequest_UPDATED_AT, OrderDirection: tc.orderDirection, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -601,7 +601,7 @@ func TestListEnabledFeaturesPageSize(t *testing.T) { size := int64(2) listReq := &feature.ListEnabledFeaturesRequest{ PageSize: size, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -625,7 +625,7 @@ func TestListEnabledFeaturesCursor(t *testing.T) { size := int64(2) listReq := &feature.ListEnabledFeaturesRequest{ PageSize: size, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -645,7 +645,7 @@ func TestListEnabledFeaturesCursor(t *testing.T) { listReq = &feature.ListEnabledFeaturesRequest{ PageSize: size, Cursor: response.Cursor, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } response, err = client.ListEnabledFeatures(ctx, listReq) if err != nil { @@ -668,7 +668,7 @@ func TestRename(t *testing.T) { updateReq := &feature.UpdateFeatureDetailsRequest{ Id: cmd.Id, RenameFeatureCommand: &feature.RenameFeatureCommand{Name: expected}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -693,7 +693,7 @@ func TestChangeDescription(t *testing.T) { updateReq := &feature.UpdateFeatureDetailsRequest{ Id: cmd.Id, ChangeDescriptionCommand: &feature.ChangeDescriptionCommand{Description: expected}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -722,7 +722,7 @@ func TestAddTags(t *testing.T) { {Tag: newTags[1]}, {Tag: newTags[2]}, }, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -751,7 +751,7 @@ func TestRemoveTags(t *testing.T) { removeReq := &feature.UpdateFeatureDetailsRequest{ Id: cmd.Id, RemoveTagCommands: removeTargetTags, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -1448,14 +1448,14 @@ func TestCloneFeature(t *testing.T) { targetEnvironmentId := newUUID(t) c := newEnvironmentClient(t) defer c.Close() - envCmd := newEnvironmentCommand(targetEnvironmentNamespace) + envCmd := newEnvironmentCommand(targetenvironmentId) createEnvironment(t, c, envCmd) req := &feature.CloneFeatureRequest{ Id: featureID, Command: &feature.CloneFeatureCommand{ - EnvironmentNamespace: targetEnvironmentNamespace, + environmentId: targetenvironmentId, }, - EnvironmentNamespace: *environmentNamespace, + environmentId: *environmentId, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -1463,7 +1463,7 @@ func TestCloneFeature(t *testing.T) { t.Fatal(err) } f = getFeature(t, featureID, client) - cf := getClonedFeature(t, featureID, targetEnvironmentNamespace, client) + cf := getClonedFeature(t, featureID, targetenvironmentId, client) if cf.Id != f.Id { t.Fatalf("Different ids. Expected: %s actual: %s", f.Id, cf.Id) } @@ -1543,23 +1543,23 @@ func TestCloneFeature(t *testing.T) { }) require.NoError(t, err) updateFeatureTargeting(t, client, changeCmd, featureID) - anotherTargetEnvironmentNamespace := newUUID(t) + anotherTargetenvironmentId := newUUID(t) c = newEnvironmentClient(t) defer c.Close() - envCmd = newEnvironmentCommand(anotherTargetEnvironmentNamespace) + envCmd = newEnvironmentCommand(anotherTargetenvironmentId) createEnvironment(t, c, envCmd) req = &feature.CloneFeatureRequest{ Id: featureID, Command: &feature.CloneFeatureCommand{ - EnvironmentNamespace: anotherTargetEnvironmentNamespace, + environmentId: anotherTargetenvironmentId, }, - EnvironmentNamespace: *environmentNamespace, + environmentId: *environmentId, } if _, err := client.CloneFeature(ctx, req); err != nil { t.Fatal(err) } f = getFeature(t, featureID, client) - cf = getClonedFeature(t, featureID, anotherTargetEnvironmentNamespace, client) + cf = getClonedFeature(t, featureID, anotherTargetenvironmentId, client) for i := range cf.Rules { for idx := range cf.Rules[i].Strategy.RolloutStrategy.Variations { if cf.Rules[i].Strategy.RolloutStrategy.Variations[idx].Weight != f.Rules[i].Strategy.RolloutStrategy.Variations[idx].Weight { @@ -1733,7 +1733,7 @@ func createFeature(t *testing.T, client featureclient.Client, cmd *feature.Creat t.Helper() createReq := &feature.CreateFeatureRequest{ Command: cmd, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -1746,7 +1746,7 @@ func getFeature(t *testing.T, featureID string, client featureclient.Client) *fe t.Helper() getReq := &feature.GetFeatureRequest{ Id: featureID, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -1762,7 +1762,7 @@ func getClonedFeature(t *testing.T, featureID, en string, client featureclient.C t.Helper() getReq := &feature.GetFeatureRequest{ Id: featureID, - EnvironmentNamespace: en, + environmentId: en, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -1786,7 +1786,7 @@ func enableFeature(t *testing.T, featureID string, client featureclient.Client) enableReq := &feature.EnableFeatureRequest{ Id: featureID, Command: &feature.EnableFeatureCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -1822,7 +1822,7 @@ func updateVariations(t *testing.T, featureID string, commands []*feature.Comman updateReq := &feature.UpdateFeatureVariationsRequest{ Id: featureID, Commands: commands, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -1963,7 +1963,7 @@ func updateFeatureTargeting(t *testing.T, client featureclient.Client, cmd *any. Commands: []*feature.Command{ {Command: cmd}, }, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, From: feature.UpdateFeatureTargetingRequest_USER, } ctx, cancel := context.WithTimeout(context.Background(), timeout) @@ -1989,7 +1989,7 @@ func evaluateFeatures(t *testing.T, client featureclient.Client, userID, tag str t.Helper() req := &feature.EvaluateFeaturesRequest{ User: &userproto.User{Id: userID}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Tag: tag, } ctx, cancel := context.WithTimeout(context.Background(), timeout) @@ -2017,7 +2017,7 @@ func createProgressiveRollout( ProgressiveRolloutTemplateScheduleClause: template, } _, err := client.CreateProgressiveRollout(ctx, &aoproto.CreateProgressiveRolloutRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Command: cmd, }) if err != nil { @@ -2030,7 +2030,7 @@ func listProgressiveRollouts(t *testing.T, client aoclient.Client, featureID str ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() resp, err := client.ListProgressiveRollouts(ctx, &aoproto.ListProgressiveRolloutsRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, PageSize: 0, FeatureIds: []string{featureID}, }) @@ -2045,7 +2045,7 @@ func getProgressiveRollout(t *testing.T, client aoclient.Client, id string) *aop ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() resp, err := client.GetProgressiveRollout(ctx, &aoproto.GetProgressiveRolloutRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, }) if err != nil { @@ -2097,8 +2097,8 @@ func newEnvironmentCommand(id string) *environment.CreateEnvironmentCommand { namespace := strings.Replace(id, "-", "", -1) return &environment.CreateEnvironmentCommand{ Namespace: namespace, - Name: "e2e-test-environment-namespace", - Description: "e2e-test-environment-namespace-description", + Name: "e2e-test-environment-id", + Description: "e2e-test-environment-id-description", Id: id, ProjectId: defaultProjectID, } diff --git a/test/e2e/feature/segment_test.go b/test/e2e/feature/segment_test.go index 245f8e745..21a0a3e89 100644 --- a/test/e2e/feature/segment_test.go +++ b/test/e2e/feature/segment_test.go @@ -39,14 +39,14 @@ func TestCreateListSegmentNoCommand(t *testing.T) { defer cancel() client := newFeatureClient(t) createResp, err := client.CreateSegment(ctx, &featureproto.CreateSegmentRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Name: newSegmentName(t), Description: fmt.Sprintf("%s-description", prefixSegment), }) assert.NoError(t, err) listResp, err := client.ListSegments(ctx, &featureproto.ListSegmentsRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) assert.NoError(t, err) assert.NotNil(t, listResp) @@ -66,7 +66,7 @@ func TestCreateListSegmentNoCommand(t *testing.T) { // delete segment _, err = client.DeleteSegment(ctx, &featureproto.DeleteSegmentRequest{ Id: segment.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) assert.NoError(t, err) } @@ -76,7 +76,7 @@ func TestCreateUpdateNoCommand(t *testing.T) { defer cancel() client := newFeatureClient(t) createResp, err := client.CreateSegment(ctx, &featureproto.CreateSegmentRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Name: newSegmentName(t), Description: fmt.Sprintf("%s-description", prefixSegment), }) @@ -86,7 +86,7 @@ func TestCreateUpdateNoCommand(t *testing.T) { updateResp, err := client.UpdateSegment(ctx, &featureproto.UpdateSegmentRequest{ Id: createResp.Segment.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Name: wrapperspb.String(fmt.Sprintf("%s-update", segment.Name)), }) assert.NoError(t, err) @@ -98,7 +98,7 @@ func TestCreateUpdateNoCommand(t *testing.T) { // delete segment _, err = client.DeleteSegment(ctx, &featureproto.DeleteSegmentRequest{ Id: segment.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) assert.NoError(t, err) } @@ -113,7 +113,7 @@ func TestCreateSegment(t *testing.T) { } req := &featureproto.CreateSegmentRequest{ Command: cmd, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } res, err := client.CreateSegment(ctx, req) assert.NoError(t, err) @@ -177,7 +177,7 @@ func TestChangeSegmentName(t *testing.T) { Commands: []*featureproto.Command{ {Command: cmdChange}, }, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }, ) assert.NotNil(t, res) @@ -200,7 +200,7 @@ func TestChangeSegmentName(t *testing.T) { Commands: []*featureproto.Command{ {Command: cmdChange}, }, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }, ) assert.NotNil(t, res) @@ -224,7 +224,7 @@ func TestChangeSegmentDescription(t *testing.T) { Commands: []*featureproto.Command{ {Command: cmdChange}, }, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }, ) assert.NotNil(t, res) @@ -243,7 +243,7 @@ func TestDeleteSegment(t *testing.T) { &featureproto.DeleteSegmentRequest{ Id: id, Command: &featureproto.DeleteSegmentCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }, ) assert.NotNil(t, res) @@ -262,7 +262,7 @@ func TestListSegmentsPageSize(t *testing.T) { pageSize := int64(1) res, err := client.ListSegments(ctx, &featureproto.ListSegmentsRequest{ PageSize: pageSize, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) assert.NoError(t, err) assert.Equal(t, pageSize, int64(len(res.Segments))) @@ -278,7 +278,7 @@ func TestListSegmentsCursor(t *testing.T) { pageSize := int64(2) res, err := client.ListSegments(ctx, &featureproto.ListSegmentsRequest{ PageSize: pageSize, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) assert.NoError(t, err) assert.NotEmpty(t, res.Cursor) @@ -287,7 +287,7 @@ func TestListSegmentsCursor(t *testing.T) { &featureproto.ListSegmentsRequest{ PageSize: pageSize, Cursor: res.Cursor, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }, ) assert.NoError(t, err) @@ -304,7 +304,7 @@ func getSegment(ctx context.Context, t *testing.T, client featureclient.Client, t.Helper() req := &featureproto.GetSegmentRequest{ Id: id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } res, err := client.GetSegment(ctx, req) assert.NoError(t, err) @@ -319,7 +319,7 @@ func createSegment(ctx context.Context, t *testing.T, client featureclient.Clien } req := &featureproto.CreateSegmentRequest{ Command: cmd, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } res, err := client.CreateSegment(ctx, req) assert.NoError(t, err) diff --git a/test/e2e/feature/segment_user_test.go b/test/e2e/feature/segment_user_test.go index ee830d169..fef522c4b 100644 --- a/test/e2e/feature/segment_user_test.go +++ b/test/e2e/feature/segment_user_test.go @@ -105,7 +105,7 @@ func TestListSegmentUsersPageSize(t *testing.T) { PageSize: pageSize, SegmentId: segmentID, State: &wrappersproto.Int32Value{Value: int32(featureproto.SegmentUser_INCLUDED)}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) assert.NoError(t, err) assert.Equal(t, pageSize, int64(len(res.Users))) @@ -129,7 +129,7 @@ func TestListSegmentUsersCursor(t *testing.T) { Cursor: cursor, SegmentId: segmentID, State: state, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) assert.NoError(t, err) assert.NotEmpty(t, res.Cursor) @@ -177,7 +177,7 @@ func TestBulkUploadAndDownloadSegmentUsers(t *testing.T) { sort.Strings(uids) userIDs := []byte(fmt.Sprintf("%s\n%s\n%s\n", uids[0], uids[1], uids[2])) uploadRes, err := client.BulkUploadSegmentUsers(ctx, &featureproto.BulkUploadSegmentUsersRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, SegmentId: segmentID, Command: &featureproto.BulkUploadSegmentUsersCommand{ Data: userIDs, @@ -207,7 +207,7 @@ func addSegmentUser(ctx context.Context, t *testing.T, client featureclient.Clie UserIds: userIDs, State: state, }, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } res, err := client.AddSegmentUser(ctx, req) assert.NotNil(t, res) @@ -221,7 +221,7 @@ func deleteSegmentUser(ctx context.Context, t *testing.T, client featureclient.C UserIds: userIDs, State: state, }, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } res, err := client.DeleteSegmentUser(ctx, req) assert.NotNil(t, res) @@ -234,7 +234,7 @@ func getSegmentUser(ctx context.Context, t *testing.T, client featureclient.Clie SegmentId: segmentID, UserId: userID, State: state, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } res, err := client.GetSegmentUser(ctx, req) assert.NoError(t, err) @@ -246,7 +246,7 @@ func listSegmentUsers(ctx context.Context, t *testing.T, client featureclient.Cl req := &featureproto.ListSegmentUsersRequest{ SegmentId: segmentID, State: state, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } res, err := client.ListSegmentUsers(ctx, req) assert.NoError(t, err) @@ -282,7 +282,7 @@ func bulkDownloadSegmentUsers(t *testing.T, client featureclient.Client, segment ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() return client.BulkDownloadSegmentUsers(ctx, &featureproto.BulkDownloadSegmentUsersRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, SegmentId: segmentID, State: featureproto.SegmentUser_INCLUDED, }) diff --git a/test/e2e/feature/tag_test.go b/test/e2e/feature/tag_test.go index 2c7daffec..1f165f5f3 100644 --- a/test/e2e/feature/tag_test.go +++ b/test/e2e/feature/tag_test.go @@ -86,7 +86,7 @@ func listTags(ctx context.Context, t *testing.T, client featureclient.Client) [] t.Helper() resp, err := client.ListTags(ctx, &feature.ListTagsRequest{ PageSize: int64(500), - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal("failed to list tags", err) @@ -101,7 +101,7 @@ func addTag(t *testing.T, tag string, featureID string, client featureclient.Cli AddTagCommands: []*feature.AddTagCommand{ {Tag: tag}, }, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() diff --git a/test/e2e/gateway/api_grpc_test.go b/test/e2e/gateway/api_grpc_test.go index 95995b41c..72f2d5fa1 100644 --- a/test/e2e/gateway/api_grpc_test.go +++ b/test/e2e/gateway/api_grpc_test.go @@ -49,18 +49,18 @@ const ( ) var ( - webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") - webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") - webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") - apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") - apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") - gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") - gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") - gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") - serviceTokenPath = flag.String("service-token", "", "Service token path") - environmentNamespace = flag.String("environment-namespace", "", "Environment namespace") - organizationID = flag.String("organization-id", "", "Organization ID") - testID = flag.String("test-id", "", "test ID") + webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") + webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") + webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") + apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") + apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") + gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") + gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") + gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") + serviceTokenPath = flag.String("service-token", "", "Service token path") + environmentID = flag.String("environment-id", "", "Environment id") + organizationID = flag.String("organization-id", "", "Organization ID") + testID = flag.String("test-id", "", "test ID") ) func TestAPIKey(t *testing.T) { @@ -1075,7 +1075,7 @@ func createFeature( t.Helper() createReq := &featureproto.CreateFeatureRequest{ Command: cmd, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -1089,7 +1089,7 @@ func getFeature(t *testing.T, featureID string, client featureclient.Client) *fe t.Helper() getReq := &featureproto.GetFeatureRequest{ Id: featureID, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -1107,7 +1107,7 @@ func addTag(t *testing.T, tag string, featureID string, client featureclient.Cli AddTagCommands: []*featureproto.AddTagCommand{ {Tag: tag}, }, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -1128,7 +1128,7 @@ func enableFeature(t *testing.T, featureID string, client featureclient.Client) enableReq := &featureproto.EnableFeatureRequest{ Id: featureID, Command: &featureproto.EnableFeatureCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -1142,7 +1142,7 @@ func archiveFeature(t *testing.T, featureID string, client featureclient.Client) req := &featureproto.ArchiveFeatureRequest{ Id: featureID, Command: &featureproto.ArchiveFeatureCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -1279,7 +1279,7 @@ func updateFeatureTargeting(t *testing.T, client featureclient.Client, cmd *any. Commands: []*featureproto.Command{ {Command: cmd}, }, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, From: featureproto.UpdateFeatureTargetingRequest_USER, } ctx, cancel := context.WithTimeout(context.Background(), timeout) diff --git a/test/e2e/notification/subscription_test.go b/test/e2e/notification/subscription_test.go index 522c99cc7..29757ca4e 100644 --- a/test/e2e/notification/subscription_test.go +++ b/test/e2e/notification/subscription_test.go @@ -38,18 +38,18 @@ const ( ) var ( - webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") - webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") - webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") - apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") - apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") - gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") - gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") - gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") - serviceTokenPath = flag.String("service-token", "", "Service token path") - environmentNamespace = flag.String("environment-namespace", "", "Environment namespace") - organizationID = flag.String("organization-id", "", "Organization ID") - testID = flag.String("test-id", "", "test ID") + webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") + webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") + webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") + apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") + apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") + gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") + gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") + gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") + serviceTokenPath = flag.String("service-token", "", "Service token path") + environmentID = flag.String("environment-id", "", "Environment id") + organizationID = flag.String("organization-id", "", "Organization ID") + testID = flag.String("test-id", "", "test ID") ) func TestCreateListSubscriptionNoCommand(t *testing.T) { @@ -108,7 +108,7 @@ func TestCreateListSubscriptionNoCommand(t *testing.T) { t.Fatalf("Incorrect deleted. Expected: %t actual: %t", false, subscription.Disabled) } _, err = notificationClient.DeleteSubscription(ctx, &proto.DeleteSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, }) if err != nil { @@ -144,7 +144,7 @@ func TestCreateUpdateSubscriptionNoCommand(t *testing.T) { proto.Subscription_DOMAIN_EVENT_ADMIN_ACCOUNT, } resp, err := notificationClient.UpdateSubscription(ctx, &proto.UpdateSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, SourceTypes: updatedSourceTypes, Name: wrapperspb.String(updatedName), @@ -177,7 +177,7 @@ func TestCreateUpdateSubscriptionNoCommand(t *testing.T) { t.Fatalf("Incorrect deleted. Expected: %t actual: %t", false, subscription.Disabled) } _, err = notificationClient.DeleteSubscription(ctx, &proto.DeleteSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, }) if err != nil { @@ -207,7 +207,7 @@ func TestCreateGetDeleteSubscription(t *testing.T) { } createSubscription(ctx, t, notificationClient, name, sourceTypes, recipient) resp, err := notificationClient.GetSubscription(ctx, &proto.GetSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, }) if err != nil { @@ -236,7 +236,7 @@ func TestCreateGetDeleteSubscription(t *testing.T) { t.Fatalf("Incorrect deleted. Expected: %t actual: %t", false, subscription.Disabled) } _, err = notificationClient.DeleteSubscription(ctx, &proto.DeleteSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, Command: &proto.DeleteSubscriptionCommand{}, }) @@ -244,7 +244,7 @@ func TestCreateGetDeleteSubscription(t *testing.T) { t.Fatal(err) } _, err = notificationClient.GetSubscription(ctx, &proto.GetSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, }) if err != nil { @@ -306,7 +306,7 @@ func TestCreateListDeleteSubscription(t *testing.T) { t.Fatalf("Incorrect deleted. Expected: %t actual: %t", false, subscription.Disabled) } _, err = notificationClient.DeleteSubscription(ctx, &proto.DeleteSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, Command: &proto.DeleteSubscriptionCommand{}, }) @@ -314,7 +314,7 @@ func TestCreateListDeleteSubscription(t *testing.T) { t.Fatal(err) } _, err = notificationClient.GetSubscription(ctx, &proto.GetSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, }) if err != nil { @@ -347,7 +347,7 @@ func TestUpdateSubscription(t *testing.T) { } createSubscription(ctx, t, notificationClient, name, sourceTypes, recipient) _, err = notificationClient.UpdateSubscription(ctx, &proto.UpdateSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, AddSourceTypesCommand: &proto.AddSourceTypesCommand{ SourceTypes: []proto.Subscription_SourceType{ @@ -364,7 +364,7 @@ func TestUpdateSubscription(t *testing.T) { t.Fatal(err) } resp, err := notificationClient.GetSubscription(ctx, &proto.GetSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, }) if err != nil { @@ -393,7 +393,7 @@ func TestUpdateSubscription(t *testing.T) { t.Fatalf("Incorrect deleted. Expected: %t actual: %t", false, subscription.Disabled) } _, err = notificationClient.DeleteSubscription(ctx, &proto.DeleteSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, Command: &proto.DeleteSubscriptionCommand{}, }) @@ -401,7 +401,7 @@ func TestUpdateSubscription(t *testing.T) { t.Fatal(err) } _, err = notificationClient.GetSubscription(ctx, &proto.GetSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, }) if err != nil { @@ -434,7 +434,7 @@ func TestListEnabledSubscriptions(t *testing.T) { } createSubscription(ctx, t, notificationClient, name, sourceTypes, recipient) _, err = notificationClient.DisableSubscription(ctx, &proto.DisableSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, Command: &proto.DisableSubscriptionCommand{}, }) @@ -457,7 +457,7 @@ func TestListEnabledSubscriptions(t *testing.T) { t.Fatal("List enabled subscriptions include disabled subscription") } _, err = notificationClient.DeleteSubscription(ctx, &proto.DeleteSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Id: id, Command: &proto.DeleteSubscriptionCommand{}, }) @@ -505,7 +505,7 @@ func createSubscription( t.Helper() cmd := newCreateSubscriptionCommand(name, sourceTypes, recipient) createReq := &proto.CreateSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Command: cmd, } if _, err := client.CreateSubscription(ctx, createReq); err != nil { @@ -533,7 +533,7 @@ func listSubscriptions( ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() resp, err := client.ListSubscriptions(ctx, &proto.ListSubscriptionsRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, PageSize: int64(500), SourceTypes: sourceTypes, }) @@ -551,7 +551,7 @@ func listEnabledSubscriptions( ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() resp, err := client.ListEnabledSubscriptions(ctx, &proto.ListEnabledSubscriptionsRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, PageSize: int64(500), SourceTypes: sourceTypes, }) @@ -571,7 +571,7 @@ func createSubscriptionNoCommand( t.Helper() createReq := &proto.CreateSubscriptionRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Name: name, SourceTypes: sourceTypes, Recipient: recipient, diff --git a/test/e2e/push/push_test.go b/test/e2e/push/push_test.go index 79f86b428..62eb07fba 100644 --- a/test/e2e/push/push_test.go +++ b/test/e2e/push/push_test.go @@ -38,18 +38,18 @@ const ( ) var ( - webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") - webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") - webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") - apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") - apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") - gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") - gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") - gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") - serviceTokenPath = flag.String("service-token", "", "Service token path") - environmentNamespace = flag.String("environment-namespace", "", "Environment namespace") - organizationID = flag.String("organization-id", "", "Organization ID") - testID = flag.String("test-id", "", "test ID") + webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") + webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") + webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") + apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") + apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") + gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") + gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") + gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") + serviceTokenPath = flag.String("service-token", "", "Service token path") + environmentID = flag.String("environment-id", "", "Environment id") + organizationID = flag.String("organization-id", "", "Organization ID") + testID = flag.String("test-id", "", "test ID") fcmServiceAccountDummy = `{ "type": "service_account", @@ -183,7 +183,7 @@ func TestUpdatePush(t *testing.T) { // Update the push updateReq := &pushproto.UpdatePushRequest{ Id: push.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Name: &wrappers.StringValue{Value: newName}, Tags: []string{newTag}, Disabled: wrapperspb.Bool(true), @@ -242,7 +242,7 @@ func createFeature(ctx context.Context, t *testing.T, client featureclient.Clien cmd := newCreateFeatureCommand(featureID, tag) createReq := &featureproto.CreateFeatureRequest{ Command: cmd, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } if _, err := client.CreateFeature(ctx, createReq); err != nil { t.Fatal(err) @@ -255,7 +255,7 @@ func enableFeature(t *testing.T, featureID string, client featureclient.Client) enableReq := &featureproto.EnableFeatureRequest{ Id: featureID, Command: &featureproto.EnableFeatureCommand{}, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -325,7 +325,7 @@ func createPush( t.Helper() cmd := newCreatePushCommand(t, fcmServiceAccount, []string{tag}) createReq := &pushproto.CreatePushRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Command: cmd, } if _, err := client.CreatePush(ctx, createReq); err != nil { @@ -342,7 +342,7 @@ func createPushNoCommand( ) { t.Helper() createReq := &pushproto.CreatePushRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, Name: newPushName(t), Tags: []string{tag}, FcmServiceAccount: fcmServiceAccount, @@ -365,7 +365,7 @@ func listPushes(t *testing.T, client pushclient.Client) []*pushproto.Push { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() resp, err := client.ListPushes(ctx, &pushproto.ListPushesRequest{ - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, PageSize: int64(500), }) if err != nil { diff --git a/test/e2e/tag/tag_test.go b/test/e2e/tag/tag_test.go index 9b07d2ce2..f24b9c291 100644 --- a/test/e2e/tag/tag_test.go +++ b/test/e2e/tag/tag_test.go @@ -35,18 +35,18 @@ const ( var ( // FIXME: To avoid compiling the test many times, webGatewayAddr, webGatewayPort & apiKey has been also added here to prevent from getting: // "flag provided but not defined" error during the test. These 3 are being use in the Gateway test - webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") - webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") - webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") - apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") - apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") - gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") - gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") - gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") - serviceTokenPath = flag.String("service-token", "", "Service token path") - environmentNamespace = flag.String("environment-namespace", "", "Environment namespace") - testID = flag.String("test-id", "", "test ID") - organizationID = flag.String("organization-id", "", "Organization ID") + webGatewayAddr = flag.String("web-gateway-addr", "", "Web gateway endpoint address") + webGatewayPort = flag.Int("web-gateway-port", 443, "Web gateway endpoint port") + webGatewayCert = flag.String("web-gateway-cert", "", "Web gateway crt file") + apiKeyPath = flag.String("api-key", "", "Client SDK API key for api-gateway") + apiKeyServerPath = flag.String("api-key-server", "", "Server SDK API key for api-gateway") + gatewayAddr = flag.String("gateway-addr", "", "Gateway endpoint address") + gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port") + gatewayCert = flag.String("gateway-cert", "", "Gateway crt file") + serviceTokenPath = flag.String("service-token", "", "Service token path") + environmentID = flag.String("environment-id", "", "Environment id") + testID = flag.String("test-id", "", "test ID") + organizationID = flag.String("organization-id", "", "Organization ID") ) func TestUpsertAndListTag(t *testing.T) { @@ -91,7 +91,7 @@ func TestDeleteTag(t *testing.T) { // Create tag createReq := &tagproto.CreateTagRequest{ Name: newTagName(t), - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, EntityType: tagproto.Tag_FEATURE_FLAG, } resp, err := client.CreateTag(ctx, createReq) @@ -101,7 +101,7 @@ func TestDeleteTag(t *testing.T) { // Delete tag req := &tagproto.DeleteTagRequest{ Id: resp.Tag.Id, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, } defer cancel() if _, err := client.DeleteTag(ctx, req); err != nil { @@ -120,7 +120,7 @@ func listTags(ctx context.Context, t *testing.T, client tagclient.Client) []*tag t.Helper() resp, err := client.ListTags(ctx, &tagproto.ListTagsRequest{ PageSize: 0, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, }) if err != nil { t.Fatal("Failed to list tags", err) @@ -185,7 +185,7 @@ func createTag( t.Helper() createReq := &tagproto.CreateTagRequest{ Name: tag, - EnvironmentId: *environmentNamespace, + EnvironmentId: *environmentID, EntityType: entityType, } ctx, cancel := context.WithTimeout(context.Background(), timeout)