Visitar URL original
Add test case · docker/cli@ed838bf · GitHub
Skip to content

Commit ed838bf

Browse files
committed
Add test case
Signed-off-by: Sune Keller <absukl@almbrand.dk>
1 parent c662ba0 commit ed838bf

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

‎cli/compose/loader/loader_test.go‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,3 +1586,67 @@ secrets:
15861586
}
15871587
assert.DeepEqual(t, config, expected, cmpopts.EquateEmpty())
15881588
}
1589+
1590+
func TestLoadSecretDriver(t *testing.T) {
1591+
config, err := loadYAML(`
1592+
version: '3.8'
1593+
services:
1594+
hello-world:
1595+
image: redis:alpine
1596+
secrets:
1597+
- secret
1598+
configs:
1599+
- config
1600+
1601+
configs:
1602+
config:
1603+
name: config
1604+
external: true
1605+
1606+
secrets:
1607+
secret:
1608+
name: secret
1609+
driver: secret-bucket
1610+
driver_opts:
1611+
OptionA: value for driver option A
1612+
OptionB: value for driver option B
1613+
`)
1614+
assert.NilError(t, err)
1615+
expected := &types.Config{
1616+
Filename: "filename.yml",
1617+
Version: "3.8",
1618+
Services: types.Services{
1619+
{
1620+
Name: "hello-world",
1621+
Image: "redis:alpine",
1622+
Configs: []types.ServiceConfigObjConfig{
1623+
{
1624+
Source: "config",
1625+
},
1626+
},
1627+
Secrets: []types.ServiceSecretConfig{
1628+
{
1629+
Source: "secret",
1630+
},
1631+
},
1632+
},
1633+
},
1634+
Configs: map[string]types.ConfigObjConfig{
1635+
"config": {
1636+
Name: "config",
1637+
External: types.External{External: true},
1638+
},
1639+
},
1640+
Secrets: map[string]types.SecretConfig{
1641+
"secret": {
1642+
Name: "secret",
1643+
Driver: "secret-bucket",
1644+
DriverOpts: map[string]string{
1645+
"OptionA": "value for driver option A",
1646+
"OptionB": "value for driver option B",
1647+
},
1648+
},
1649+
},
1650+
}
1651+
assert.DeepEqual(t, config, expected, cmpopts.EquateEmpty())
1652+
}

0 commit comments

Comments
 (0)