Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit b4177f9

Browse files
committed
Added integration tests for sorts
1 parent 80a0a96 commit b4177f9

6 files changed

+186
-3
lines changed

.container-diff-tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ while IFS=$' \n\r' read -r flag differ image1 image2 file; do
55
echo "container-diff" "$differ" "differ failed"
66
exit 1
77
fi
8-
done < tests/differ_runs.txt
8+
done < tests/test_differ_runs.txt
99

1010
while IFS=$' \n\r' read -r flag analyzer image file; do
1111
go run main.go $image $flag -j > $file
1212
if [[ $? -ne 0 ]]; then
1313
echo "container-diff" "$analyzer" "analyzer failed"
1414
exit 1
1515
fi
16-
done < tests/analyzer_runs.txt
16+
done < tests/test_analyzer_runs.txt
1717

1818
success=0
1919
while IFS=$' \n\r' read -r type analyzer actual expected; do
@@ -22,7 +22,7 @@ while IFS=$' \n\r' read -r type analyzer actual expected; do
2222
echo "container-diff" "$analyzer" "$type" "output is not as expected"
2323
success=1
2424
fi
25-
done < tests/diff_comparisons.txt
25+
done < tests/test_run_comparisons.txt
2626
if [[ "$success" -ne 0 ]]; then
2727
exit 1
2828
fi

tests/apt_sorted_diff_expected.json

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
[
2+
{
3+
"Image1": "gcr.io/gcp-runtimes/apt-base",
4+
"Image2": "gcr.io/gcp-runtimes/apt-modified",
5+
"DiffType": "Apt",
6+
"Diff": {
7+
"Packages1": [
8+
{
9+
"Name": "libpython3.5-stdlib",
10+
"Version": "3.5.3-1",
11+
"Size": 10133504
12+
},
13+
{
14+
"Name": "python3.5-minimal",
15+
"Version": "3.5.3-1",
16+
"Size": 9636864
17+
},
18+
{
19+
"Name": "libpython3.5-minimal",
20+
"Version": "3.5.3-1",
21+
"Size": 3836928
22+
},
23+
{
24+
"Name": "dh-python",
25+
"Version": "2.20170125",
26+
"Size": 411648
27+
},
28+
{
29+
"Name": "python3.5",
30+
"Version": "3.5.3-1",
31+
"Size": 326656
32+
},
33+
{
34+
"Name": "libmpdec2",
35+
"Version": "2.4.2-1",
36+
"Size": 260096
37+
},
38+
{
39+
"Name": "python3-minimal",
40+
"Version": "3.5.3-1",
41+
"Size": 122880
42+
},
43+
{
44+
"Name": "python3",
45+
"Version": "3.5.3-1",
46+
"Size": 68608
47+
},
48+
{
49+
"Name": "libpython3-stdlib",
50+
"Version": "3.5.3-1",
51+
"Size": 36864
52+
}
53+
],
54+
"Packages2": [
55+
{
56+
"Name": "libpython2.7-stdlib",
57+
"Version": "2.7.13-2",
58+
"Size": 8755200
59+
},
60+
{
61+
"Name": "python2.7-minimal",
62+
"Version": "2.7.13-2",
63+
"Size": 3911680
64+
},
65+
{
66+
"Name": "libpython2.7-minimal",
67+
"Version": "2.7.13-2",
68+
"Size": 2833408
69+
},
70+
{
71+
"Name": "python",
72+
"Version": "2.7.13-2",
73+
"Size": 663552
74+
},
75+
{
76+
"Name": "python2.7",
77+
"Version": "2.7.13-2",
78+
"Size": 367616
79+
},
80+
{
81+
"Name": "python-minimal",
82+
"Version": "2.7.13-2",
83+
"Size": 148480
84+
},
85+
{
86+
"Name": "libffi6",
87+
"Version": "3.2.1-6",
88+
"Size": 57344
89+
},
90+
{
91+
"Name": "libpython-stdlib",
92+
"Version": "2.7.13-2",
93+
"Size": 37888
94+
}
95+
],
96+
"InfoDiff": []
97+
}
98+
}
99+
]
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
[
2+
{
3+
"Image": "gcr.io/gcp-runtimes/diff-modified",
4+
"AnalyzeType": "File",
5+
"Analysis": [
6+
{
7+
"Name": "/bin",
8+
"Size": 1105296
9+
},
10+
{
11+
"Name": "/bin/[",
12+
"Size": 1026712
13+
},
14+
{
15+
"Name": "/bin/getconf",
16+
"Size": 78584
17+
},
18+
{
19+
"Name": "/etc",
20+
"Size": 1008
21+
},
22+
{
23+
"Name": "/etc/passwd",
24+
"Size": 340
25+
},
26+
{
27+
"Name": "/etc/group",
28+
"Size": 307
29+
},
30+
{
31+
"Name": "/etc/shadow",
32+
"Size": 243
33+
},
34+
{
35+
"Name": "/etc/localtime",
36+
"Size": 118
37+
},
38+
{
39+
"Name": "/dev",
40+
"Size": 0
41+
},
42+
{
43+
"Name": "/home",
44+
"Size": 0
45+
},
46+
{
47+
"Name": "/root",
48+
"Size": 0
49+
},
50+
{
51+
"Name": "/tmp",
52+
"Size": 0
53+
},
54+
{
55+
"Name": "/usr",
56+
"Size": 0
57+
},
58+
{
59+
"Name": "/usr/sbin",
60+
"Size": 0
61+
},
62+
{
63+
"Name": "/var",
64+
"Size": 0
65+
},
66+
{
67+
"Name": "/var/spool",
68+
"Size": 0
69+
},
70+
{
71+
"Name": "/var/spool/mail",
72+
"Size": 0
73+
},
74+
{
75+
"Name": "/var/www",
76+
"Size": 0
77+
}
78+
]
79+
}
80+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
-p pip gcr.io/gcp-runtimes/pip-modified tests/pip_analysis_actual.json
22
-a apt gcr.io/gcp-runtimes/apt-modified tests/apt_analysis_actual.json
33
-n node gcr.io/gcp-runtimes/node-modified tests/node_analysis_actual.json
4+
-fo fileOrder gcr.io/gcp-runtimes/diff-modified tests/file_sorted_analysis_actual.json

tests/differ_runs.txt renamed to tests/test_differ_runs.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
-n nodeOrder gcr.io/gcp-runtimes/node-modified:2.0 gcr.io/gcp-runtimes/node-modified tests/node_diff_order_actual.json
44
-npa multi gcr.io/gcp-runtimes/multi-base gcr.io/gcp-runtimes/multi-modified tests/multi_diff_actual.json
55
-d history gcr.io/gcp-runtimes/diff-base gcr.io/gcp-runtimes/diff-modified tests/hist_diff_actual.json
6+
-ao aptSort gcr.io/gcp-runtimes/apt-base gcr.io/gcp-runtimes/apt-modified tests/apt_sorted_diff_actual.json

tests/diff_comparisons.txt renamed to tests/test_run_comparisons.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ history diff tests/hist_diff_actual.json tests/hist_diff_expected.json
66
pip analysis tests/pip_analysis_actual.json tests/pip_analysis_expected.json
77
apt analysis tests/apt_analysis_actual.json tests/apt_analysis_expected.json
88
node analysis tests/node_analysis_actual.json tests/node_analysis_expected.json
9+
aptSort diff tests/apt_sorted_diff_actual.json tests/apt_sorted_diff_expected.json
10+
fileSort analyis tests/file_sorted_analysis_actual.json tests/file_sorted_analysis_expected.json

0 commit comments

Comments
 (0)