Skip to content

Commit

Permalink
fix: test idempotency
Browse files Browse the repository at this point in the history
  • Loading branch information
alnr committed Sep 9, 2024
1 parent 03470ca commit 408913d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
16 changes: 6 additions & 10 deletions selfservice/strategy/oidc/strategy_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"encoding/json"
"fmt"
"io"
"net"
"net/http"
"net/http/httptest"
"net/url"
Expand Down Expand Up @@ -203,17 +204,12 @@ func newHydraIntegration(t *testing.T, remote *string, subject *string, claims *
parsed, err := url.ParseRequestURI(addr)
require.NoError(t, err)

//#nosec G112
server := &http.Server{Addr: ":" + parsed.Port(), Handler: router}
go func(t *testing.T) {
if err := server.ListenAndServe(); err != http.ErrServerClosed {
require.NoError(t, err)
} else if err == nil {
require.NoError(t, server.Close())
}
}(t)
listener, err := net.Listen("tcp", ":"+parsed.Port())
require.NoError(t, err, "port busy?")
server := &http.Server{Handler: router}
go server.Serve(listener)
t.Cleanup(func() {
require.NoError(t, server.Close())
assert.NoError(t, server.Close())
})
return server, addr
}
Expand Down
2 changes: 1 addition & 1 deletion selfservice/strategy/oidc/strategy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import (
)

func TestStrategy(t *testing.T) {
testStrategy(t)
t.Run("", TestStrategy)

t.Run("newStyleState", func(t *testing.T) {
oidc.TestHookEnableNewStyleState(t)
Expand Down

0 comments on commit 408913d

Please sign in to comment.