The tests using these functions were removed in e89b6e8c2d2c36c43f22aeaf2a885646c2994051
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -12,8 +12,6 @@ import ( |
| 12 | 12 |
"github.com/docker/docker/api/types/container" |
| 13 | 13 |
networktypes "github.com/docker/docker/api/types/network" |
| 14 | 14 |
"github.com/docker/docker/api/types/strslice" |
| 15 |
- "gotest.tools/assert" |
|
| 16 |
- is "gotest.tools/assert/cmp" |
|
| 17 | 15 |
) |
| 18 | 16 |
|
| 19 | 17 |
type f struct {
|
| ... | ... |
@@ -134,57 +132,3 @@ func callDecodeContainerConfigIsolation(isolation string) (*container.Config, *c |
| 134 | 134 |
} |
| 135 | 135 |
return decodeContainerConfig(bytes.NewReader(b)) |
| 136 | 136 |
} |
| 137 |
- |
|
| 138 |
-type decodeConfigTestcase struct {
|
|
| 139 |
- doc string |
|
| 140 |
- wrapper ContainerConfigWrapper |
|
| 141 |
- expectedErr string |
|
| 142 |
- expectedConfig *container.Config |
|
| 143 |
- expectedHostConfig *container.HostConfig |
|
| 144 |
- goos string |
|
| 145 |
-} |
|
| 146 |
- |
|
| 147 |
-func runDecodeContainerConfigTestCase(testcase decodeConfigTestcase) func(t *testing.T) {
|
|
| 148 |
- return func(t *testing.T) {
|
|
| 149 |
- raw := marshal(t, testcase.wrapper, testcase.doc) |
|
| 150 |
- config, hostConfig, _, err := decodeContainerConfig(bytes.NewReader(raw)) |
|
| 151 |
- if testcase.expectedErr != "" {
|
|
| 152 |
- if !assert.Check(t, is.ErrorContains(err, "")) {
|
|
| 153 |
- return |
|
| 154 |
- } |
|
| 155 |
- assert.Check(t, is.Contains(err.Error(), testcase.expectedErr)) |
|
| 156 |
- return |
|
| 157 |
- } |
|
| 158 |
- assert.Check(t, err) |
|
| 159 |
- assert.Check(t, is.DeepEqual(testcase.expectedConfig, config)) |
|
| 160 |
- assert.Check(t, is.DeepEqual(testcase.expectedHostConfig, hostConfig)) |
|
| 161 |
- } |
|
| 162 |
-} |
|
| 163 |
- |
|
| 164 |
-func marshal(t *testing.T, w ContainerConfigWrapper, doc string) []byte {
|
|
| 165 |
- b, err := json.Marshal(w) |
|
| 166 |
- assert.NilError(t, err, "%s: failed to encode config wrapper", doc) |
|
| 167 |
- return b |
|
| 168 |
-} |
|
| 169 |
- |
|
| 170 |
-func containerWrapperWithVolume(volume string) ContainerConfigWrapper {
|
|
| 171 |
- return ContainerConfigWrapper{
|
|
| 172 |
- Config: &container.Config{
|
|
| 173 |
- Volumes: map[string]struct{}{
|
|
| 174 |
- volume: {},
|
|
| 175 |
- }, |
|
| 176 |
- }, |
|
| 177 |
- HostConfig: &container.HostConfig{},
|
|
| 178 |
- } |
|
| 179 |
-} |
|
| 180 |
- |
|
| 181 |
-func containerWrapperWithBind(bind string) ContainerConfigWrapper {
|
|
| 182 |
- return ContainerConfigWrapper{
|
|
| 183 |
- Config: &container.Config{
|
|
| 184 |
- Volumes: map[string]struct{}{},
|
|
| 185 |
- }, |
|
| 186 |
- HostConfig: &container.HostConfig{
|
|
| 187 |
- Binds: []string{bind},
|
|
| 188 |
- }, |
|
| 189 |
- } |
|
| 190 |
-} |