|
| 1 | +/* |
| 2 | +Copyright 2019 The Kubernetes Authors. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package docker |
| 18 | + |
| 19 | +import "testing" |
| 20 | + |
| 21 | +func TestNetworkAction(t *testing.T) { |
| 22 | + var testNetworkName = "kind-test-network" |
| 23 | + |
| 24 | + if err := CreateNetwork(testNetworkName); err != nil { |
| 25 | + t.Error("expected an error for CreateNetwork") |
| 26 | + } |
| 27 | + |
| 28 | + if willBeTrue := IsNetworkExist(testNetworkName); willBeTrue != true { |
| 29 | + t.Error("expected an error for IsNetworkExist") |
| 30 | + } |
| 31 | + |
| 32 | + if willBeTrue := isNetworkCreatedByKind(testNetworkName); willBeTrue != true { |
| 33 | + t.Error("expected an error for isNetworkCreatedByKind") |
| 34 | + } |
| 35 | + |
| 36 | + if err := DeleteNetwork(testNetworkName); err != nil { |
| 37 | + t.Error("expected an error for DeleteNetwork") |
| 38 | + } |
| 39 | + |
| 40 | + if willBeFalse := isNetworkCreatedByKind(testNetworkName); willBeFalse != false { |
| 41 | + t.Error("expected an error for isNetworkCreatedByKind") |
| 42 | + } |
| 43 | + |
| 44 | + if willBeFalse := isNetworkCreatedByKind("qwerty.asdfg"); willBeFalse != false { |
| 45 | + t.Error("expected an error for isNetworkCreatedByKind") |
| 46 | + } |
| 47 | + |
| 48 | +} |
0 commit comments