mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 09:41:57 +00:00
Execute tests in the prog/ directory (#2567)
Also fixed prog/main_test.go (which has never been part of the test suite so far)
This commit is contained in:
8
Makefile
8
Makefile
@@ -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)
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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/*
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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|^|./|'))
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user