Skip to content

Commit

Permalink
Make addr configurable
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <[email protected]>
  • Loading branch information
kradalby committed Oct 7, 2022
1 parent 382a37f commit 37a4d41
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/headscale/cli/mockoidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ func mockOIDC() error {
if clientSecret == "" {
return errMockOidcClientSecretNotDefined
}
addrStr := os.Getenv("MOCKOIDC_ADDR")
if addrStr == "" {
return errMockOidcPortNotDefined
}
portStr := os.Getenv("MOCKOIDC_PORT")
if portStr == "" {
return errMockOidcPortNotDefined
Expand All @@ -61,7 +65,7 @@ func mockOIDC() error {
return err
}

listener, err := net.Listen("tcp", fmt.Sprintf("headscale-mock-oidc:%d", port))
listener, err := net.Listen("tcp", fmt.Sprintf("%s:%d", addrStr, port))
if err != nil {
return err
}
Expand Down
3 changes: 3 additions & 0 deletions integration_oidc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func (s *IntegrationOIDCTestSuite) SetupSuite() {
"10000/tcp": {{HostPort: "10000"}},
},
Env: []string{
fmt.Sprintf("MOCKOIDC_ADDR=%s", oidcMockHostname),
"MOCKOIDC_PORT=10000",
"MOCKOIDC_CLIENT_ID=superclient",
"MOCKOIDC_CLIENT_SECRET=supersecret",
Expand Down Expand Up @@ -330,6 +331,8 @@ func (s *IntegrationOIDCTestSuite) AuthenticateOIDC(
resp, err := client.Get(loginURL.String())
assert.Nil(s.T(), err)

log.Printf("auth body, err: %#v, %s", resp, err)

body, err := io.ReadAll(resp.Body)
assert.Nil(s.T(), err)

Expand Down

0 comments on commit 37a4d41

Please sign in to comment.