Skip to content

Commit

Permalink
Test for endpoint fix (#867)
Browse files Browse the repository at this point in the history
  • Loading branch information
psav authored Sep 21, 2023
1 parent f290488 commit e89c7b6
Showing 1 changed file with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,60 @@ func TestAppInterfaceObjectStore(t *testing.T) {

assert.Equal(t, &expected, c)
}

func TestAppInterfaceBadBucket(t *testing.T) {
c := config.ObjectStoreConfig{
Hostname: "original",
Buckets: []config.ObjectStoreBucket{{
AccessKey: utils.StringPtr("access"),
Endpoint: utils.StringPtr("endpoint"),
Name: "badger",
Region: utils.StringPtr("region"),
RequestedName: "badger",
SecretKey: utils.StringPtr("secret"),
Tls: utils.TruePtr(),
}},
}
err := resolveBucketDeps([]string{"test-bucket"}, &c)

assert.Error(t, err)
}

func TestAppInterfaceGoodAndBadBucket(t *testing.T) {
c := config.ObjectStoreConfig{
Hostname: "original",
Buckets: []config.ObjectStoreBucket{
{
AccessKey: utils.StringPtr("access"),
Endpoint: utils.StringPtr("endpoint"),
Name: "badger",
Region: utils.StringPtr("region"),
RequestedName: "badger",
SecretKey: utils.StringPtr("secret"),
Tls: utils.TruePtr(),
}, {
AccessKey: utils.StringPtr("access"),
Endpoint: utils.StringPtr("test-endpoint"),
Name: "test-bucket",
Region: utils.StringPtr("region"),
RequestedName: "test-bucket",
SecretKey: utils.StringPtr("secret"),
Tls: utils.TruePtr(),
},
{
AccessKey: utils.StringPtr("access"),
Endpoint: utils.StringPtr("endpoint"),
Name: "badgerRage",
Region: utils.StringPtr("region"),
RequestedName: "badgerRage",
SecretKey: utils.StringPtr("secret"),
Tls: utils.TruePtr(),
},
},
}
err := resolveBucketDeps([]string{"test-bucket"}, &c)

assert.NoError(t, err)
assert.Len(t, c.Buckets, 1)
assert.Equal(t, c.Hostname, "test-endpoint")
}

0 comments on commit e89c7b6

Please sign in to comment.