|
@@ -29,7 +29,7 @@ func TestSecretInspect(t *testing.T) {
|
|
|
|
|
|
ctx := context.Background()
|
|
ctx := context.Background()
|
|
|
|
|
|
- testName := "test_secret"
|
|
|
|
|
|
+ testName := "test_secret_" + t.Name()
|
|
secretID := createSecret(ctx, t, client, testName, []byte("TESTINGDATA"), nil)
|
|
secretID := createSecret(ctx, t, client, testName, []byte("TESTINGDATA"), nil)
|
|
|
|
|
|
secret, _, err := client.SecretInspectWithRaw(context.Background(), secretID)
|
|
secret, _, err := client.SecretInspectWithRaw(context.Background(), secretID)
|
|
@@ -51,8 +51,8 @@ func TestSecretList(t *testing.T) {
|
|
defer client.Close()
|
|
defer client.Close()
|
|
ctx := context.Background()
|
|
ctx := context.Background()
|
|
|
|
|
|
- testName0 := "test0"
|
|
|
|
- testName1 := "test1"
|
|
|
|
|
|
+ testName0 := "test0_" + t.Name()
|
|
|
|
+ testName1 := "test1_" + t.Name()
|
|
testNames := []string{testName0, testName1}
|
|
testNames := []string{testName0, testName1}
|
|
sort.Strings(testNames)
|
|
sort.Strings(testNames)
|
|
|
|
|
|
@@ -137,7 +137,7 @@ func TestSecretsCreateAndDelete(t *testing.T) {
|
|
defer client.Close()
|
|
defer client.Close()
|
|
ctx := context.Background()
|
|
ctx := context.Background()
|
|
|
|
|
|
- testName := "test_secret"
|
|
|
|
|
|
+ testName := "test_secret_" + t.Name()
|
|
secretID := createSecret(ctx, t, client, testName, []byte("TESTINGDATA"), nil)
|
|
secretID := createSecret(ctx, t, client, testName, []byte("TESTINGDATA"), nil)
|
|
|
|
|
|
// create an already existin secret, daemon should return a status code of 409
|
|
// create an already existin secret, daemon should return a status code of 409
|
|
@@ -160,7 +160,7 @@ func TestSecretsCreateAndDelete(t *testing.T) {
|
|
assert.Check(t, is.ErrorContains(err, "No such secret: non-existin"))
|
|
assert.Check(t, is.ErrorContains(err, "No such secret: non-existin"))
|
|
|
|
|
|
// Ported from original TestSecretsCreteaWithLabels
|
|
// Ported from original TestSecretsCreteaWithLabels
|
|
- testName = "test_secret_with_labels"
|
|
|
|
|
|
+ testName = "test_secret_with_labels_" + t.Name()
|
|
secretID = createSecret(ctx, t, client, testName, []byte("TESTINGDATA"), map[string]string{
|
|
secretID = createSecret(ctx, t, client, testName, []byte("TESTINGDATA"), map[string]string{
|
|
"key1": "value1",
|
|
"key1": "value1",
|
|
"key2": "value2",
|
|
"key2": "value2",
|
|
@@ -184,7 +184,7 @@ func TestSecretsUpdate(t *testing.T) {
|
|
defer client.Close()
|
|
defer client.Close()
|
|
ctx := context.Background()
|
|
ctx := context.Background()
|
|
|
|
|
|
- testName := "test_secret"
|
|
|
|
|
|
+ testName := "test_secret_" + t.Name()
|
|
secretID := createSecret(ctx, t, client, testName, []byte("TESTINGDATA"), nil)
|
|
secretID := createSecret(ctx, t, client, testName, []byte("TESTINGDATA"), nil)
|
|
|
|
|
|
insp, _, err := client.SecretInspectWithRaw(ctx, secretID)
|
|
insp, _, err := client.SecretInspectWithRaw(ctx, secretID)
|
|
@@ -232,27 +232,30 @@ func TestTemplatedSecret(t *testing.T) {
|
|
defer client.Close()
|
|
defer client.Close()
|
|
ctx := context.Background()
|
|
ctx := context.Background()
|
|
|
|
|
|
|
|
+ referencedSecretName := "referencedsecret_" + t.Name()
|
|
referencedSecretSpec := swarmtypes.SecretSpec{
|
|
referencedSecretSpec := swarmtypes.SecretSpec{
|
|
Annotations: swarmtypes.Annotations{
|
|
Annotations: swarmtypes.Annotations{
|
|
- Name: "referencedsecret",
|
|
|
|
|
|
+ Name: referencedSecretName,
|
|
},
|
|
},
|
|
Data: []byte("this is a secret"),
|
|
Data: []byte("this is a secret"),
|
|
}
|
|
}
|
|
referencedSecret, err := client.SecretCreate(ctx, referencedSecretSpec)
|
|
referencedSecret, err := client.SecretCreate(ctx, referencedSecretSpec)
|
|
assert.Check(t, err)
|
|
assert.Check(t, err)
|
|
|
|
|
|
|
|
+ referencedConfigName := "referencedconfig_" + t.Name()
|
|
referencedConfigSpec := swarmtypes.ConfigSpec{
|
|
referencedConfigSpec := swarmtypes.ConfigSpec{
|
|
Annotations: swarmtypes.Annotations{
|
|
Annotations: swarmtypes.Annotations{
|
|
- Name: "referencedconfig",
|
|
|
|
|
|
+ Name: referencedConfigName,
|
|
},
|
|
},
|
|
Data: []byte("this is a config"),
|
|
Data: []byte("this is a config"),
|
|
}
|
|
}
|
|
referencedConfig, err := client.ConfigCreate(ctx, referencedConfigSpec)
|
|
referencedConfig, err := client.ConfigCreate(ctx, referencedConfigSpec)
|
|
assert.Check(t, err)
|
|
assert.Check(t, err)
|
|
|
|
|
|
|
|
+ templatedSecretName := "templated_secret_" + t.Name()
|
|
secretSpec := swarmtypes.SecretSpec{
|
|
secretSpec := swarmtypes.SecretSpec{
|
|
Annotations: swarmtypes.Annotations{
|
|
Annotations: swarmtypes.Annotations{
|
|
- Name: "templated_secret",
|
|
|
|
|
|
+ Name: templatedSecretName,
|
|
},
|
|
},
|
|
Templating: &swarmtypes.Driver{
|
|
Templating: &swarmtypes.Driver{
|
|
Name: "golang",
|
|
Name: "golang",
|
|
@@ -265,6 +268,7 @@ func TestTemplatedSecret(t *testing.T) {
|
|
templatedSecret, err := client.SecretCreate(ctx, secretSpec)
|
|
templatedSecret, err := client.SecretCreate(ctx, secretSpec)
|
|
assert.Check(t, err)
|
|
assert.Check(t, err)
|
|
|
|
|
|
|
|
+ serviceName := "svc_" + t.Name()
|
|
serviceID := swarm.CreateService(t, d,
|
|
serviceID := swarm.CreateService(t, d,
|
|
swarm.ServiceWithSecret(
|
|
swarm.ServiceWithSecret(
|
|
&swarmtypes.SecretReference{
|
|
&swarmtypes.SecretReference{
|
|
@@ -275,7 +279,7 @@ func TestTemplatedSecret(t *testing.T) {
|
|
Mode: 0600,
|
|
Mode: 0600,
|
|
},
|
|
},
|
|
SecretID: templatedSecret.ID,
|
|
SecretID: templatedSecret.ID,
|
|
- SecretName: "templated_secret",
|
|
|
|
|
|
+ SecretName: templatedSecretName,
|
|
},
|
|
},
|
|
),
|
|
),
|
|
swarm.ServiceWithConfig(
|
|
swarm.ServiceWithConfig(
|
|
@@ -287,7 +291,7 @@ func TestTemplatedSecret(t *testing.T) {
|
|
Mode: 0600,
|
|
Mode: 0600,
|
|
},
|
|
},
|
|
ConfigID: referencedConfig.ID,
|
|
ConfigID: referencedConfig.ID,
|
|
- ConfigName: "referencedconfig",
|
|
|
|
|
|
+ ConfigName: referencedConfigName,
|
|
},
|
|
},
|
|
),
|
|
),
|
|
swarm.ServiceWithSecret(
|
|
swarm.ServiceWithSecret(
|
|
@@ -299,10 +303,10 @@ func TestTemplatedSecret(t *testing.T) {
|
|
Mode: 0600,
|
|
Mode: 0600,
|
|
},
|
|
},
|
|
SecretID: referencedSecret.ID,
|
|
SecretID: referencedSecret.ID,
|
|
- SecretName: "referencedsecret",
|
|
|
|
|
|
+ SecretName: referencedSecretName,
|
|
},
|
|
},
|
|
),
|
|
),
|
|
- swarm.ServiceWithName("svc"),
|
|
|
|
|
|
+ swarm.ServiceWithName(serviceName),
|
|
)
|
|
)
|
|
|
|
|
|
var tasks []swarmtypes.Task
|
|
var tasks []swarmtypes.Task
|
|
@@ -325,7 +329,7 @@ func TestTemplatedSecret(t *testing.T) {
|
|
AttachStderr: true,
|
|
AttachStderr: true,
|
|
})
|
|
})
|
|
|
|
|
|
- expect := "SERVICE_NAME=svc\n" +
|
|
|
|
|
|
+ expect := "SERVICE_NAME=" + serviceName + "\n" +
|
|
"this is a secret\n" +
|
|
"this is a secret\n" +
|
|
"this is a config\n"
|
|
"this is a config\n"
|
|
assertAttachedStream(t, attach, expect)
|
|
assertAttachedStream(t, attach, expect)
|