TUN-3890: Code coverage for cloudflared in CI
Also changed the socks test code so that it binds to localhost, so that we don't get popups saying "would you like to allow socks.test to use the network"
This commit is contained in:
parent
a4f185fd28
commit
d8bee0b4d9
|
@ -18,3 +18,4 @@ cloudflared-x86-64*
|
|||
.DS_Store
|
||||
*-session.log
|
||||
ssh_server_tests/.env
|
||||
.cover
|
||||
|
|
6
Makefile
6
Makefile
|
@ -88,7 +88,13 @@ container:
|
|||
|
||||
.PHONY: test
|
||||
test: vet
|
||||
ifndef CI
|
||||
go test -v -mod=vendor -race $(VERSION_FLAGS) ./...
|
||||
else
|
||||
@mkdir -p .cover
|
||||
go test -v -mod=vendor -race $(VERSION_FLAGS) -coverprofile=".cover/c.out" ./...
|
||||
go tool cover -html ".cover/c.out" -o .cover/all.html
|
||||
endif
|
||||
|
||||
.PHONY: test-ssh-server
|
||||
test-ssh-server:
|
||||
|
|
|
@ -27,7 +27,7 @@ func TestCreateTLSListenerOnlyHostSuccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCreateTLSListenerOnlyPortSuccess(t *testing.T) {
|
||||
listener, err := CreateTLSListener(":8888")
|
||||
listener, err := CreateTLSListener("localhost:8888")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ func startTestServer(t *testing.T, httpHandler func(w http.ResponseWriter, r *ht
|
|||
// create a socks server
|
||||
requestHandler := NewRequestHandler(NewNetDialer())
|
||||
socksServer := NewConnectionHandler(requestHandler)
|
||||
listener, err := net.Listen("tcp", ":8086")
|
||||
listener, err := net.Listen("tcp", "localhost:8086")
|
||||
assert.NoError(t, err)
|
||||
|
||||
go func() {
|
||||
|
@ -58,7 +58,7 @@ func startTestServer(t *testing.T, httpHandler func(w http.ResponseWriter, r *ht
|
|||
mux.HandleFunc("/", httpHandler)
|
||||
|
||||
// start the servers
|
||||
go http.ListenAndServe(":8085", mux)
|
||||
go http.ListenAndServe("localhost:8085", mux)
|
||||
}
|
||||
|
||||
func respondWithJSON(w http.ResponseWriter, v interface{}, status int) {
|
||||
|
|
Loading…
Reference in New Issue