From ed838bff1f83983d37d80464d367466ece889755 Mon Sep 17 00:00:00 2001 From: Sune Keller Date: Thu, 28 Mar 2019 16:17:15 +0100 Subject: [PATCH] Add test case Signed-off-by: Sune Keller --- cli/compose/loader/loader_test.go | 64 +++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/cli/compose/loader/loader_test.go b/cli/compose/loader/loader_test.go index 51eb4fb461..f78eb2f1fe 100644 --- a/cli/compose/loader/loader_test.go +++ b/cli/compose/loader/loader_test.go @@ -1586,3 +1586,67 @@ secrets: } assert.DeepEqual(t, config, expected, cmpopts.EquateEmpty()) } + +func TestLoadSecretDriver(t *testing.T) { + config, err := loadYAML(` +version: '3.8' +services: + hello-world: + image: redis:alpine + secrets: + - secret + configs: + - config + +configs: + config: + name: config + external: true + +secrets: + secret: + name: secret + driver: secret-bucket + driver_opts: + OptionA: value for driver option A + OptionB: value for driver option B +`) + assert.NilError(t, err) + expected := &types.Config{ + Filename: "filename.yml", + Version: "3.8", + Services: types.Services{ + { + Name: "hello-world", + Image: "redis:alpine", + Configs: []types.ServiceConfigObjConfig{ + { + Source: "config", + }, + }, + Secrets: []types.ServiceSecretConfig{ + { + Source: "secret", + }, + }, + }, + }, + Configs: map[string]types.ConfigObjConfig{ + "config": { + Name: "config", + External: types.External{External: true}, + }, + }, + Secrets: map[string]types.SecretConfig{ + "secret": { + Name: "secret", + Driver: "secret-bucket", + DriverOpts: map[string]string{ + "OptionA": "value for driver option A", + "OptionB": "value for driver option B", + }, + }, + }, + } + assert.DeepEqual(t, config, expected, cmpopts.EquateEmpty()) +}