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

Commit 3043561

Browse files
committed
Initial Commit
0 parents  commit 3043561

File tree

1,082 files changed

+234014
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,082 files changed

+234014
-0
lines changed

.container-diff-tests.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
while IFS=$' \n\r' read -r flag differ image1 image2 file; do
3+
go run main.go $image1 $image2 $flag -j > $file
4+
if [[ $? -ne 0 ]]; then
5+
echo "container-diff" "$differ" "differ failed"
6+
exit 1
7+
fi
8+
done < tests/differ_runs.txt
9+
10+
while IFS=$' \n\r' read -r preprocess json; do
11+
python $preprocess $json
12+
if [[ $? -ne 0 ]]; then
13+
echo "Could not preprocess" "$json" "for diff comparison"
14+
exit 1
15+
fi
16+
done < tests/preprocess_files.txt
17+
18+
success=0
19+
while IFS=$' \n\r' read -r differ actual expected; do
20+
diff=$(jq --argfile a "$actual" --argfile b "$expected" -n 'def walk(f): . as $in | if type == "object" then reduce keys[] as $key ( {}; . + { ($key): ($in[$key] | walk(f)) } ) | f elif type == "array" then map( walk(f) ) | f else f end; ($a | walk(if type == "array" then sort else . end)) as $a | ($b | walk(if type == "array" then sort else . end)) as $b | $a == $b')
21+
if ! "$diff" ; then
22+
echo "container diff" "$differ" "diff output is not as expected"
23+
success=1
24+
fi
25+
done < tests/diff_comparisons.txt
26+
if [[ "$success" -ne 0 ]]; then
27+
exit 1
28+
fi
29+
30+
go test `go list ./... | grep -v vendor`

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tests/*_actual.json

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
sudo: required
2+
dist: trusty
3+
4+
language: go
5+
go:
6+
- 1.8.1
7+
go_import_path: github.com/GoogleCloudPlatform/container-diff
8+
9+
script:
10+
- ./.gofmt.sh
11+
- sudo rm -rf /etc/docker
12+
- travis_wait ./container-diff-tests.sh

0 commit comments

Comments
 (0)