Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix prog/main_test.go #2567

Merged
merged 6 commits into from
Jun 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ $(RUNSVINIT): $(SCOPE_BACKEND_BUILD_UPTODATE)
shell: $(SCOPE_BACKEND_BUILD_UPTODATE)
/bin/bash

tests: $(SCOPE_BACKEND_BUILD_UPTODATE) $(CODECGEN_TARGETS)
tests: $(SCOPE_BACKEND_BUILD_UPTODATE) $(CODECGEN_TARGETS) prog/staticui/staticui.go prog/externalui/externalui.go
./tools/test -no-go-get

lint: $(SCOPE_BACKEND_BUILD_UPTODATE)
Expand Down Expand Up @@ -179,10 +179,12 @@ tmp/weave-scope.tgz: $(shell find client/app -type f) $(SCOPE_UI_BUILD_UPTODATE)
else

client/build/index.html:
cd client && npm run build
test "true" = "$(SCOPE_SKIP_UI_ASSETS)" && mkdir -p client/build || \
{ cd client && npm run build; }

client/build-external/index.html:
cd client && npm run build-external
test "true" = "$(SCOPE_SKIP_UI_ASSETS)" && mkdir -p client/build-external || \
{ cd client && npm run build-external; }

endif

Expand Down
1 change: 1 addition & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM ubuntu:yakkety
ENV GOPATH /go
ENV GOVERSION 1.7
ENV PATH /go/bin:/usr/lib/go-${GOVERSION}/bin:/usr/bin:/bin:/usr/sbin:/sbin
ENV SCOPE_SKIP_UI_ASSETS true
RUN apt-get update && \
apt-get install -y libpcap-dev python-requests time file shellcheck golang-${GOVERSION} git gcc-arm-linux-gnueabihf curl && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Expand Down
19 changes: 19 additions & 0 deletions prog/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ import (
"github.com/stretchr/testify/assert"
)

func TestMakeContainerFiltersFromFlags(t *testing.T) {
containerLabelFlags := containerLabelFiltersFlag{exclude: false}
containerLabelFlags.Set(`title1:label=1`)
containerLabelFlags.Set(`ti\:tle2:lab\:el=2`)
containerLabelFlags.Set(`ti tile3:label=3`)

err := containerLabelFlags.Set("just a string")
assert.NotNil(t, err, "Invalid container label flag not detected")

apiTopologyOptions := containerLabelFlags.apiTopologyOptions
assert.Equal(t, 3, len(apiTopologyOptions))
assert.Equal(t, "0", apiTopologyOptions[0].Value)
assert.Equal(t, "title1", apiTopologyOptions[0].Label)
assert.Equal(t, "1", apiTopologyOptions[1].Value)
assert.Equal(t, "ti:tle2", apiTopologyOptions[1].Label)
assert.Equal(t, "2", apiTopologyOptions[2].Value)
assert.Equal(t, "ti tile3", apiTopologyOptions[2].Label)
}

func TestLogCensoredArgs(t *testing.T) {
setupFlags(&flags{})
args := []string{
Expand Down
2 changes: 1 addition & 1 deletion tools/test
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fail=0

if [ -z "$TESTDIRS" ]; then
# NB: Relies on paths being prefixed with './'.
TESTDIRS=($(git ls-files -- '*_test.go' | grep -vE '^(vendor|prog|experimental)/' | xargs -n1 dirname | sort -u | sed -e 's|^|./|'))
TESTDIRS=($(git ls-files -- '*_test.go' | grep -vE '^(vendor|experimental)/' | xargs -n1 dirname | sort -u | sed -e 's|^|./|'))

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

else
# TESTDIRS on the right side is not really an array variable, it
# is just a string with spaces, but it is written like that to
Expand Down