Fix bug that `isNwPresent` can't distinguish network names with same
prefix.
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
| ... | ... |
@@ -201,7 +201,8 @@ func isNwPresent(c *check.C, name string) bool {
|
| 201 | 201 |
out, _ := dockerCmd(c, "network", "ls") |
| 202 | 202 |
lines := strings.Split(out, "\n") |
| 203 | 203 |
for i := 1; i < len(lines)-1; i++ {
|
| 204 |
- if strings.Contains(lines[i], name) {
|
|
| 204 |
+ netFields := strings.Fields(lines[i]) |
|
| 205 |
+ if netFields[1] == name {
|
|
| 205 | 206 |
return true |
| 206 | 207 |
} |
| 207 | 208 |
} |