(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestConfigDiff(t *testing.T) { |
| 11 | Convey("When old and new configs are equal", t, func() { |
| 12 | oldList := []mirrorConfig{ |
| 13 | {Name: "debian"}, |
| 14 | {Name: "debian-security"}, |
| 15 | {Name: "fedora"}, |
| 16 | {Name: "archlinux"}, |
| 17 | {Name: "AOSP"}, |
| 18 | {Name: "ubuntu"}, |
| 19 | } |
| 20 | newList := make([]mirrorConfig, len(oldList)) |
| 21 | copy(newList, oldList) |
| 22 | |
| 23 | difference := diffMirrorConfig(oldList, newList) |
| 24 | So(len(difference), ShouldEqual, 0) |
| 25 | }) |
| 26 | Convey("When old config is empty", t, func() { |
| 27 | newList := []mirrorConfig{ |
| 28 | {Name: "debian"}, |
| 29 | {Name: "debian-security"}, |
| 30 | {Name: "fedora"}, |
| 31 | {Name: "archlinux"}, |
| 32 | {Name: "AOSP"}, |
| 33 | {Name: "ubuntu"}, |
| 34 | } |
| 35 | oldList := make([]mirrorConfig, 0) |
| 36 | |
| 37 | difference := diffMirrorConfig(oldList, newList) |
| 38 | So(len(difference), ShouldEqual, len(newList)) |
| 39 | }) |
| 40 | Convey("When new config is empty", t, func() { |
| 41 | oldList := []mirrorConfig{ |
| 42 | {Name: "debian"}, |
| 43 | {Name: "debian-security"}, |
| 44 | {Name: "fedora"}, |
| 45 | {Name: "archlinux"}, |
| 46 | {Name: "AOSP"}, |
| 47 | {Name: "ubuntu"}, |
| 48 | } |
| 49 | newList := make([]mirrorConfig, 0) |
| 50 | |
| 51 | difference := diffMirrorConfig(oldList, newList) |
| 52 | So(len(difference), ShouldEqual, len(oldList)) |
| 53 | }) |
| 54 | Convey("When giving two config lists with different names", t, func() { |
| 55 | oldList := []mirrorConfig{ |
| 56 | {Name: "debian"}, |
| 57 | {Name: "debian-security"}, |
| 58 | {Name: "fedora"}, |
| 59 | {Name: "archlinux"}, |
| 60 | {Name: "AOSP", Env: map[string]string{"REPO": "/usr/bin/repo"}}, |
| 61 | {Name: "ubuntu"}, |
| 62 | } |
| 63 | newList := []mirrorConfig{ |
| 64 | {Name: "debian"}, |
| 65 | {Name: "debian-cd"}, |
| 66 | {Name: "archlinuxcn"}, |
| 67 | {Name: "AOSP", Env: map[string]string{"REPO": "/usr/local/bin/aosp-repo"}}, |
nothing calls this directly
no test coverage detected