Skip to content

Commit 2d6e5fb

Browse files
committed
chore(azurite): unit test for duplicate services
1 parent 5d0edae commit 2d6e5fb

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

modules/azure/azurite/azurite_test.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,11 @@ func TestAzurite_inMemoryPersistence(t *testing.T) {
3939
func TestAzurite_enabledServices(t *testing.T) {
4040
ctx := context.Background()
4141

42-
services := []azurite.Service{azurite.BlobService, azurite.QueueService, azurite.TableService, "invalid"}
42+
services := []azurite.Service{azurite.BlobService, azurite.QueueService, azurite.TableService}
4343
for _, service := range services {
4444
t.Run(string(service), func(t *testing.T) {
45-
ctr, err := azurite.Run(ctx, "mcr.microsoft.com/azure-storage/azurite:3.33.0", azurite.WithInMemoryPersistence(0), azurite.WithEnabledServices(service))
45+
ctr, err := azurite.Run(ctx, "mcr.microsoft.com/azure-storage/azurite:3.33.0", azurite.WithEnabledServices(service))
4646
testcontainers.CleanupContainer(t, ctr)
47-
if service == "invalid" {
48-
require.Error(t, err)
49-
return
50-
}
5147
require.NoError(t, err)
5248

5349
for _, srv := range services {
@@ -60,6 +56,16 @@ func TestAzurite_enabledServices(t *testing.T) {
6056
}
6157
})
6258
}
59+
60+
t.Run("unknown", func(t *testing.T) {
61+
_, err := azurite.Run(ctx, "mcr.microsoft.com/azure-storage/azurite:3.33.0", azurite.WithEnabledServices("foo"))
62+
require.EqualError(t, err, "azurite option: unknown service: foo")
63+
})
64+
65+
t.Run("duplicate", func(t *testing.T) {
66+
_, err := azurite.Run(ctx, "mcr.microsoft.com/azure-storage/azurite:3.33.0", azurite.WithEnabledServices(azurite.BlobService, azurite.BlobService))
67+
require.EqualError(t, err, "azurite option: duplicate service: blob")
68+
})
6369
}
6470

6571
func TestAzurite_serviceURL(t *testing.T) {

0 commit comments

Comments
 (0)