From a9dbbd349a0d46fe08d601a6eecd5603f88677d4 Mon Sep 17 00:00:00 2001 From: hopleus Date: Thu, 17 Oct 2024 11:38:17 +0300 Subject: [PATCH] Corrected integration tests and github test-integration workflow --- .github/workflows/test-integration.yaml | 3 +++ integration/auth_approval_test.go | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-integration.yaml b/.github/workflows/test-integration.yaml index 15848624..777ed70e 100644 --- a/.github/workflows/test-integration.yaml +++ b/.github/workflows/test-integration.yaml @@ -24,16 +24,19 @@ jobs: - TestOIDC024UserCreation - TestAuthWebFlowAuthenticationPingAll - TestAuthWebFlowLogoutAndRelogin + - TestAuthNodeApproval - TestUserCommand - TestPreAuthKeyCommand - TestPreAuthKeyCommandWithoutExpiry - TestPreAuthKeyCommandReusableEphemeral + - TestPreAuthKeyCommandPreApproved - TestPreAuthKeyCorrectUserLoggedInCommand - TestApiKeyCommand - TestNodeTagCommand - TestNodeAdvertiseTagCommand - TestNodeCommand - TestNodeExpireCommand + - TestNodeApproveCommand - TestNodeRenameCommand - TestNodeMoveCommand - TestPolicyCommand diff --git a/integration/auth_approval_test.go b/integration/auth_approval_test.go index f6a1fe51..e4359eb4 100644 --- a/integration/auth_approval_test.go +++ b/integration/auth_approval_test.go @@ -2,6 +2,7 @@ package integration import ( "context" + "crypto/tls" "fmt" v1 "github.com/juanfont/headscale/gen/go/headscale/v1" "github.com/juanfont/headscale/integration/hsic" @@ -39,6 +40,8 @@ func TestAuthNodeApproval(t *testing.T) { err = scenario.CreateHeadscaleEnv( spec, hsic.WithTestName("approval"), + hsic.WithTLS(), + hsic.WithHostnameAsServerURL(), hsic.WithManualApproveNewNode(), ) assertNoErrHeadscaleEnv(t, err) @@ -236,7 +239,16 @@ func (s *AuthApprovalScenario) runHeadscaleRegister(userStr string, loginURL *ur loginURL.Host = fmt.Sprintf("%s:8080", headscale.GetIP()) loginURL.Scheme = "http" - httpClient := &http.Client{} + if len(headscale.GetCert()) > 0 { + loginURL.Scheme = "https" + } + + insecureTransport := &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // nolint + } + httpClient := &http.Client{ + Transport: insecureTransport, + } ctx := context.Background() req, _ := http.NewRequestWithContext(ctx, http.MethodGet, loginURL.String(), nil) resp, err := httpClient.Do(req)