|
| 1 | +package docker |
| 2 | + |
| 3 | +import "testing" |
| 4 | + |
| 5 | +func TestIsMaintenanceBootStatus(t *testing.T) { |
| 6 | + tests := []struct { |
| 7 | + status string |
| 8 | + want bool |
| 9 | + }{ |
| 10 | + {status: "pack", want: true}, |
| 11 | + {status: "meld", want: true}, |
| 12 | + {status: "chop", want: true}, |
| 13 | + {status: "rollchop", want: true}, |
| 14 | + {status: "prep", want: true}, |
| 15 | + {status: "roll", want: true}, |
| 16 | + {status: "boot", want: false}, |
| 17 | + {status: "noboot", want: false}, |
| 18 | + {status: "ignore", want: false}, |
| 19 | + } |
| 20 | + |
| 21 | + for _, test := range tests { |
| 22 | + if got := IsMaintenanceBootStatus(test.status); got != test.want { |
| 23 | + t.Fatalf("IsMaintenanceBootStatus(%q) = %v, want %v", test.status, got, test.want) |
| 24 | + } |
| 25 | + } |
| 26 | +} |
| 27 | + |
| 28 | +func TestPersistentBootStatusAfterContainerBuild(t *testing.T) { |
| 29 | + tests := []struct { |
| 30 | + status string |
| 31 | + want string |
| 32 | + }{ |
| 33 | + {status: "pack", want: "noboot"}, |
| 34 | + {status: "meld", want: "noboot"}, |
| 35 | + {status: "chop", want: "noboot"}, |
| 36 | + {status: "rollchop", want: "noboot"}, |
| 37 | + {status: "noboot", want: "noboot"}, |
| 38 | + {status: "ignore", want: "ignore"}, |
| 39 | + {status: "boot", want: "boot"}, |
| 40 | + {status: "prep", want: "boot"}, |
| 41 | + {status: "roll", want: "boot"}, |
| 42 | + } |
| 43 | + |
| 44 | + for _, test := range tests { |
| 45 | + if got := PersistentBootStatusAfterContainerBuild(test.status); got != test.want { |
| 46 | + t.Fatalf("PersistentBootStatusAfterContainerBuild(%q) = %q, want %q", test.status, got, test.want) |
| 47 | + } |
| 48 | + } |
| 49 | +} |
0 commit comments