@@ -44,6 +44,13 @@ VENOM=$(GOPATH)/bin/venom
4444$(VENOM ) :
4545 go install github.com/ovh/venom/cmd/venom@$(VENOMVERSION )
4646
47+ # Local proxy target for the integration tests: a self-hosted httpbin (go-httpbin) so the
48+ # proxy mocks don't depend on the flaky public httpbin.org.
49+ GOHTTPBINVERSION: =v2.18.3
50+ GOHTTPBIN =$(GOPATH ) /bin/go-httpbin
51+ $(GOHTTPBIN ) :
52+ go install github.com/mccutchen/go-httpbin/v2/cmd/go-httpbin@$(GOHTTPBINVERSION )
53+
4754GOCOVMERGE =$(GOPATH ) /bin/gocovmerge
4855$(GOCOVMERGE ) :
4956 go install github.com/wadey/gocovmerge@latest
@@ -90,14 +97,19 @@ test:
9097 go test -v -race -coverprofile=$(COVERAGE_DIR ) /test-cover.out ./server/...
9198
9299PID_FILE =/tmp/$(APPNAME ) .test.pid
100+ HTTPBIN_PID_FILE =/tmp/$(APPNAME ) .httpbin.pid
101+ PROXY_TARGET_PORT ?= 8090
93102.PHONY : test-integration
94- test-integration : $(VENOM ) check-default-ports persistence
103+ test-integration : $(VENOM ) $( GOHTTPBIN ) check-default-ports persistence
95104 mkdir -p $(COVERAGE_DIR )
96105 go test -race -coverpkg=" ./..." -c . -o $(BUILD_DIR ) /$(APPNAME ) .test
106+ $(GOHTTPBIN ) -port $(PROXY_TARGET_PORT ) > /dev/null 2>&1 & echo $$ ! > $(HTTPBIN_PID_FILE )
97107 SMOCKER_PERSISTENCE_DIRECTORY=./$(SESSIONS_DIR ) $(BUILD_DIR ) /$(APPNAME ) .test -test.coverprofile=$(COVERAGE_DIR ) /test-integration-cover.out > /dev/null 2>&1 & echo $$ ! > $(PID_FILE )
98108 sleep 5
99- $(VENOM ) run tests/features/$(SUITE )
100- kill ` cat $( PID_FILE) ` 2> /dev/null || true
109+ @ret=0; $(VENOM ) run tests/features/$(SUITE ) || ret=$$? ; \
110+ kill ` cat $( PID_FILE) ` 2> /dev/null || true ; \
111+ kill ` cat $( HTTPBIN_PID_FILE) ` 2> /dev/null || true ; \
112+ exit $$ ret
101113
102114.PHONY : start-integration
103115start-integration : $(VENOM )
0 commit comments