@@ -7,111 +7,10 @@ import (
77 "os"
88 "strings"
99
10- "github.com/docker/docker/api/types/swarm"
1110 "github.com/docker/docker/integration-cli/checker"
1211 "github.com/go-check/check"
1312)
1413
15- func (s * DockerSwarmSuite ) TestConfigCreate (c * check.C ) {
16- d := s .AddDaemon (c , true , true )
17-
18- testName := "test_config"
19- id := d .CreateConfig (c , swarm.ConfigSpec {
20- Annotations : swarm.Annotations {
21- Name : testName ,
22- },
23- Data : []byte ("TESTINGDATA" ),
24- })
25- c .Assert (id , checker .Not (checker .Equals ), "" , check .Commentf ("configs: %s" , id ))
26-
27- config := d .GetConfig (c , id )
28- c .Assert (config .Spec .Name , checker .Equals , testName )
29- }
30-
31- func (s * DockerSwarmSuite ) TestConfigCreateWithLabels (c * check.C ) {
32- d := s .AddDaemon (c , true , true )
33-
34- testName := "test_config"
35- id := d .CreateConfig (c , swarm.ConfigSpec {
36- Annotations : swarm.Annotations {
37- Name : testName ,
38- Labels : map [string ]string {
39- "key1" : "value1" ,
40- "key2" : "value2" ,
41- },
42- },
43- Data : []byte ("TESTINGDATA" ),
44- })
45- c .Assert (id , checker .Not (checker .Equals ), "" , check .Commentf ("configs: %s" , id ))
46-
47- config := d .GetConfig (c , id )
48- c .Assert (config .Spec .Name , checker .Equals , testName )
49- c .Assert (len (config .Spec .Labels ), checker .Equals , 2 )
50- c .Assert (config .Spec .Labels ["key1" ], checker .Equals , "value1" )
51- c .Assert (config .Spec .Labels ["key2" ], checker .Equals , "value2" )
52- }
53-
54- // Test case for 28884
55- func (s * DockerSwarmSuite ) TestConfigCreateResolve (c * check.C ) {
56- d := s .AddDaemon (c , true , true )
57-
58- name := "test_config"
59- id := d .CreateConfig (c , swarm.ConfigSpec {
60- Annotations : swarm.Annotations {
61- Name : name ,
62- },
63- Data : []byte ("foo" ),
64- })
65- c .Assert (id , checker .Not (checker .Equals ), "" , check .Commentf ("configs: %s" , id ))
66-
67- fake := d .CreateConfig (c , swarm.ConfigSpec {
68- Annotations : swarm.Annotations {
69- Name : id ,
70- },
71- Data : []byte ("fake foo" ),
72- })
73- c .Assert (fake , checker .Not (checker .Equals ), "" , check .Commentf ("configs: %s" , fake ))
74-
75- out , err := d .Cmd ("config" , "ls" )
76- c .Assert (err , checker .IsNil )
77- c .Assert (out , checker .Contains , name )
78- c .Assert (out , checker .Contains , fake )
79-
80- out , err = d .Cmd ("config" , "rm" , id )
81- c .Assert (err , checker .IsNil )
82- c .Assert (out , checker .Contains , id )
83-
84- // Fake one will remain
85- out , err = d .Cmd ("config" , "ls" )
86- c .Assert (err , checker .IsNil )
87- c .Assert (out , checker .Not (checker .Contains ), name )
88- c .Assert (out , checker .Contains , fake )
89-
90- // Remove based on name prefix of the fake one
91- // (which is the same as the ID of foo one) should not work
92- // as search is only done based on:
93- // - Full ID
94- // - Full Name
95- // - Partial ID (prefix)
96- out , err = d .Cmd ("config" , "rm" , id [:5 ])
97- c .Assert (err , checker .Not (checker .IsNil ))
98- c .Assert (out , checker .Not (checker .Contains ), id )
99- out , err = d .Cmd ("config" , "ls" )
100- c .Assert (err , checker .IsNil )
101- c .Assert (out , checker .Not (checker .Contains ), name )
102- c .Assert (out , checker .Contains , fake )
103-
104- // Remove based on ID prefix of the fake one should succeed
105- out , err = d .Cmd ("config" , "rm" , fake [:5 ])
106- c .Assert (err , checker .IsNil )
107- c .Assert (out , checker .Contains , fake [:5 ])
108- out , err = d .Cmd ("config" , "ls" )
109- c .Assert (err , checker .IsNil )
110- c .Assert (out , checker .Not (checker .Contains ), name )
111- c .Assert (out , checker .Not (checker .Contains ), id )
112- c .Assert (out , checker .Not (checker .Contains ), fake )
113- }
114-
11514func (s * DockerSwarmSuite ) TestConfigCreateWithFile (c * check.C ) {
11615 d := s .AddDaemon (c , true , true )
11716
0 commit comments