1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
package preflight
import (
"testing"
. ".."
)
func TestPackageUpdateDepMissing(t *testing.T) {
PlaybookTest{
Path: "playbooks/package_update_dep_missing.yml",
ExitCode: 2,
Output: []string{
"check \"package_update\":",
"Could not perform a yum update.",
"break-yum-update-1.0-2.noarch requires package-that-does-not-exist",
},
}.Run(t)
}
func TestPackageUpdateRepoBroken(t *testing.T) {
PlaybookTest{
Path: "playbooks/package_update_repo_broken.yml",
ExitCode: 2,
Output: []string{
"check \"package_update\":",
"Error with yum repository configuration: Cannot find a valid baseurl for repo",
},
}.Run(t)
}
func TestPackageUpdateRepoDisabled(t *testing.T) {
PlaybookTest{
Path: "playbooks/package_update_repo_disabled.yml",
ExitCode: 0,
Output: []string{
"CHECK [package_update",
},
}.Run(t)
}
func TestPackageUpdateRepoUnreachable(t *testing.T) {
PlaybookTest{
Path: "playbooks/package_update_repo_unreachable.yml",
ExitCode: 2,
Output: []string{
"check \"package_update\":",
"Error getting data from at least one yum repository",
},
}.Run(t)
}
func TestPackageVersionMatches(t *testing.T) {
PlaybookTest{
Path: "playbooks/package_version_matches.yml",
ExitCode: 0,
Output: []string{
"CHECK [package_version",
},
}.Run(t)
}
func TestPackageVersionMismatches(t *testing.T) {
PlaybookTest{
Path: "playbooks/package_version_mismatches.yml",
ExitCode: 2,
Output: []string{
"check \"package_version\":",
"Not all of the required packages are available at requested version",
},
}.Run(t)
}
func TestPackageVersionMultiple(t *testing.T) {
PlaybookTest{
Path: "playbooks/package_version_multiple.yml",
ExitCode: 2,
Output: []string{
"check \"package_version\":",
"Multiple minor versions of these packages are available",
},
}.Run(t)
}
func TestPackageAvailabilityMissingRequired(t *testing.T) {
PlaybookTest{
Path: "playbooks/package_availability_missing_required.yml",
ExitCode: 2,
Output: []string{
"check \"package_availability\":",
"Cannot install all of the necessary packages.",
"atomic-openshift",
},
}.Run(t)
}
func TestPackageAvailabilitySucceeds(t *testing.T) {
PlaybookTest{
Path: "playbooks/package_availability_succeeds.yml",
ExitCode: 0,
Output: []string{
"CHECK [package_availability",
},
}.Run(t)
}
|