-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
455 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM busybox:latest | ||
ADD README.md /somefile.txt | ||
RUN mkdir -p /root/example/really/nested | ||
RUN cp /somefile.txt /root/example/somefile1.txt | ||
RUN chmod 444 /root/example/somefile1.txt | ||
RUN cp /somefile.txt /root/example/somefile2.txt | ||
RUN cp /somefile.txt /root/example/somefile3.txt | ||
RUN mv /root/example/somefile3.txt /root/saved.txt | ||
RUN cp /root/saved.txt /root/.saved.txt | ||
RUN rm -rf /root/example/ | ||
ADD .scripts/ /root/.data/ | ||
RUN cp /root/saved.txt /tmp/saved.again1.txt | ||
RUN cp /root/saved.txt /root/.data/saved.again2.txt | ||
RUN chmod +x /root/saved.txt |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/.git | ||
/.scripts | ||
/.data | ||
/dist | ||
/ui | ||
/utils | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,5 @@ | |
/vendor | ||
/.image | ||
*.log | ||
/dist | ||
/dist | ||
.cover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/sh | ||
# Generate test coverage statistics for Go packages. | ||
# | ||
# Works around the fact that `go test -coverprofile` currently does not work | ||
# with multiple packages, see https://code.google.com/p/go/issues/detail?id=6909 | ||
# | ||
# Usage: script/coverage [--html|--coveralls] | ||
# | ||
# --html Additionally create HTML report and open it in browser | ||
# --coveralls Push coverage statistics to coveralls.io | ||
# | ||
# Source: https://github.com/mlafeldt/chef-runner/blob/v0.7.0/script/coverage | ||
|
||
set -e | ||
|
||
workdir=.cover | ||
profile="$workdir/cover.out" | ||
mode=count | ||
|
||
generate_cover_data() { | ||
rm -rf "$workdir" | ||
mkdir "$workdir" | ||
|
||
for pkg in "$@"; do | ||
f="$workdir/$(echo $pkg | tr / -).cover" | ||
go test -v -covermode="$mode" -coverprofile="$f" "$pkg" | ||
done | ||
|
||
echo "mode: $mode" >"$profile" | ||
grep -h -v "^mode:" "$workdir"/*.cover >>"$profile" | ||
} | ||
|
||
show_cover_report() { | ||
go tool cover -${1}="$profile" | ||
} | ||
|
||
push_to_coveralls() { | ||
echo "Pushing coverage statistics to coveralls.io" | ||
goveralls -coverprofile="$profile" | ||
} | ||
|
||
generate_cover_data $(go list ./...) | ||
case "$1" in | ||
"") | ||
show_cover_report func | ||
;; | ||
--html) | ||
show_cover_report html | ||
;; | ||
--coveralls) | ||
push_to_coveralls | ||
;; | ||
*) | ||
echo >&2 "error: invalid option: $1"; exit 1 ;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package image | ||
|
||
type AnalyzerFactory func() Analyzer | ||
type AnalyzerFactory func(string) Analyzer | ||
|
||
func GetAnalyzer(imageID string) Analyzer { | ||
// todo: add ability to have multiple image formats... for the meantime only use docker | ||
var factory AnalyzerFactory = newDockerImageAnalyzer | ||
|
||
return factory() | ||
return factory(imageID) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package image | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
func TestLoadDockerImageTar(tarPath string) (*AnalysisResult, error) { | ||
f, err := os.Open(tarPath) | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer f.Close() | ||
analyzer := newDockerImageAnalyzer("dive-test:latest") | ||
err = analyzer.Parse(f) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return analyzer.Analyze() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.