Skip to content

Commit 8cbc47e

Browse files
committed
fix(acc_test) set region in BuildClientOptions, fix redis tests
1 parent 34bded6 commit 8cbc47e

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

stackit/internal/services/redis/redis_acc_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import (
2020
var instanceResource = map[string]string{
2121
"project_id": testutil.ProjectId,
2222
"name": testutil.ResourceNameWithDateTime("redis"),
23-
"plan_id": "96e24604-7a43-4ff8-9ba4-609d4235a137",
23+
"plan_id": "3849f72f-99cc-4e2c-afda-700d66ef08f2",
2424
"plan_name": "stackit-redis-1.4.10-single",
25-
"version": "6",
25+
"version": "7",
2626
"sgw_acl_invalid": "1.2.3.4/4",
2727
"sgw_acl_valid": "192.168.0.0/16",
2828
"sgw_acl_valid2": "10.10.10.0/24",

stackit/internal/testutil/testutil.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ func (b *ConfigBuilder) BuildClientOptions(service customEndpointConfig) []sdkCo
255255
if tokenEndPoint != "" {
256256
opts = append(opts, sdkConf.WithTokenEndpoint(tokenEndPoint))
257257
}
258+
if b.region != "" {
259+
opts = append(opts, sdkConf.WithRegion(b.region))
260+
}
258261
return opts
259262
}
260263

stackit/internal/testutil/testutil_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,22 +181,26 @@ func TestConfigBuilderClientOptions(t *testing.T) {
181181
{
182182
name: "default",
183183
builder: NewConfigBuilder(),
184-
want: sdkConf.Configuration{},
184+
want: sdkConf.Configuration{
185+
Region: "eu01",
186+
},
185187
},
186188
{
187189
name: "custom token endpoint",
188190
builder: NewConfigBuilder().
189191
CustomEndpoint(TokenCustomEndpoint, "http://token.example.com"),
190192
want: sdkConf.Configuration{
191193
TokenCustomUrl: "http://token.example.com",
194+
Region: "eu01",
192195
},
193196
},
194197
{
195198
name: "token",
196199
builder: NewConfigBuilder().
197200
ServiceAccountToken("expected-token"),
198201
want: sdkConf.Configuration{
199-
Token: "expected-token",
202+
Token: "expected-token",
203+
Region: "eu01",
200204
},
201205
},
202206
{
@@ -210,6 +214,7 @@ func TestConfigBuilderClientOptions(t *testing.T) {
210214
Description: "User provided URL",
211215
},
212216
},
217+
Region: "eu01",
213218
},
214219
},
215220
}
@@ -255,6 +260,7 @@ func TestConfigBuilderClientOptionsEnvVar(t *testing.T) {
255260
Description: "User provided URL",
256261
},
257262
},
263+
Region: "eu01",
258264
}
259265
if d := cmp.Diff(got, want, cmpopts.IgnoreUnexported(sdkConf.Configuration{})); d != "" {
260266
t.Errorf("ConfigBuilder.BuildClientOptions() = diff: %s", d)

0 commit comments

Comments
 (0)