Skip to content

Commit

Permalink
Create defaultTenantName const
Browse files Browse the repository at this point in the history
Signed-off-by: Jéssica Lins <jessicaalins@gmail.com>
  • Loading branch information
jessicalins committed Jan 24, 2022
1 parent 7d50a67 commit 0b60005
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions test/e2e/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const (

defaultTenantID = "1610b0c3-c509-4592-a256-a1871353dbfa"
mtlsTenantID = "845cdfd9-f936-443c-979c-2ee7dc91f646"

defaultTenantName = "test-oidc"
)

const tenantsYamlTpl = `
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/interactive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func TestInteractiveSetup(t *testing.T) {

up, err := newUpRun(
e, "up-metrics-read-write", metrics,
"https://"+api.InternalEndpoint("https")+"/api/metrics/v1/test-oidc/api/v1/query",
"https://"+api.InternalEndpoint("https")+"/api/metrics/v1/test-oidc/api/v1/receive",
"https://"+api.InternalEndpoint("https")+"/api/metrics/v1/"+defaultTenantName+"/api/v1/query",
"https://"+api.InternalEndpoint("https")+"/api/metrics/v1/"+defaultTenantName+"/api/v1/receive",
withToken(token),
withRunParameters(&runParams{period: "5000ms", threshold: "1", latency: "10s", duration: "0"}),
)
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ func TestLogsReadWriteAndTail(t *testing.T) {
t.Run("logs-tail", func(t *testing.T) {
up, err := newUpRun(
e, "up-logs-tail", logs,
"https://"+api.InternalEndpoint("https")+"/api/logs/v1/test-oidc/loki/api/v1/query",
"https://"+api.InternalEndpoint("https")+"/api/logs/v1/test-oidc/loki/api/v1/push",
"https://"+api.InternalEndpoint("https")+"/api/logs/v1/"+defaultTenantName+"/loki/api/v1/query",
"https://"+api.InternalEndpoint("https")+"/api/logs/v1/"+defaultTenantName+"/loki/api/v1/push",
withToken(token),
withRunParameters(&runParams{initialDelay: "0s", period: "250ms", threshold: "1", latency: "10s", duration: "0"}),
)
Expand All @@ -112,7 +112,7 @@ func TestLogsReadWriteAndTail(t *testing.T) {

d := websocket.Dialer{TLSClientConfig: getTLSClientConfig(t, e)}
conn, _, err := d.Dial(
"wss://"+api.Endpoint("https")+"/api/logs/v1/test-oidc/loki/api/v1/tail?query=%7B_id%3D%22test%22%7D",
"wss://"+api.Endpoint("https")+"/api/logs/v1/"+defaultTenantName+"/loki/api/v1/tail?query=%7B_id%3D%22test%22%7D",
http.Header{
"Authorization": []string{"Bearer " + token},
"X-Scope-OrgID": []string{defaultTenantID},
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func TestMetricsReadAndWrite(t *testing.T) {
t.Run("metrics-read-write", func(t *testing.T) {
up, err := newUpRun(
e, "up-metrics-read-write", metrics,
"https://"+api.InternalEndpoint("https")+"/api/metrics/v1/test-oidc/api/v1/query",
"https://"+api.InternalEndpoint("https")+"/api/metrics/v1/test-oidc/api/v1/receive",
"https://"+api.InternalEndpoint("https")+"/api/metrics/v1/"+defaultTenantName+"/api/v1/query",
"https://"+api.InternalEndpoint("https")+"/api/metrics/v1/"+defaultTenantName+"/api/v1/receive",
withToken(token),
withRunParameters(&runParams{period: "500ms", threshold: "1", latency: "10s", duration: "0"}),
)
Expand Down Expand Up @@ -106,7 +106,7 @@ func TestMetricsReadAndWrite(t *testing.T) {
}

apiTest, err := promapi.NewClient(promapi.Config{
Address: "https://" + api.Endpoint("https") + "/api/metrics/v1/test-oidc",
Address: "https://" + api.Endpoint("https") + "/api/metrics/v1/"+defaultTenantName,
RoundTripper: &tokenRoundTripper{rt: tr, token: token},
})
testutil.Ok(t, err)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestRulesAPI(t *testing.T) {
testutil.Ok(t, err)
testutil.Ok(t, e2e.StartAndWaitReady(api))

rulesEndpointURL := "https://" + api.Endpoint("https") + "/api/metrics/v1/test-oidc/api/v1/rules/raw"
rulesEndpointURL := "https://" + api.Endpoint("https") + "/api/metrics/v1/"+defaultTenantName+"/api/v1/rules/raw"
tr := &http.Transport{
TLSClientConfig: getTLSClientConfig(t, e),
}
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/tenants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestTenantsRetryAuthenticationProviderRegistration(t *testing.T) {
[]string{"observatorium_api_tenants_failed_registrations"},
e2e.WaitMissingMetrics(),
e2e.WithLabelMatchers(
matchers.MustNewMatcher(matchers.MatchEqual, "tenant", "test-oidc"),
matchers.MustNewMatcher(matchers.MatchEqual, "tenant", defaultTenantName),
matchers.MustNewMatcher(matchers.MatchEqual, "provider", "oidc"),
),
))
Expand All @@ -62,8 +62,8 @@ func TestTenantsRetryAuthenticationProviderRegistration(t *testing.T) {

up, err := newUpRun(
e, "up-tenants", metrics,
"https://"+api.InternalEndpoint("https")+"/api/metrics/v1/test-oidc/api/v1/query",
"https://"+api.InternalEndpoint("https")+"/api/metrics/v1/test-oidc/api/v1/receive",
"https://"+api.InternalEndpoint("https")+"/api/metrics/v1/"+defaultTenantName+"/api/v1/query",
"https://"+api.InternalEndpoint("https")+"/api/metrics/v1/"+defaultTenantName+"/api/v1/receive",
withToken(token),
withRunParameters(&runParams{initialDelay: "100ms", period: "300ms", threshold: "1", latency: "5s", duration: "0"}),
)
Expand Down

0 comments on commit 0b60005

Please sign in to comment.