Skip to content

Commit

Permalink
fix: improve test stability
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <[email protected]>
  • Loading branch information
JeyJeyGao committed Oct 21, 2024
1 parent c61a032 commit 6275ff6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion revocation/revocation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,9 @@ func TestCRL(t *testing.T) {
}

revocationClient, err := NewWithOptions(Options{
OCSPHTTPClient: &http.Client{},
OCSPHTTPClient: &http.Client{
Transport: &serverErrorTransport{},
},
CRLFetcher: fetcher,
CertChainPurpose: purpose.CodeSigning,
})
Expand Down Expand Up @@ -1352,6 +1354,15 @@ func (t panicTransport) RoundTrip(req *http.Request) (*http.Response, error) {
panic("panic")
}

type serverErrorTransport struct{}

func (t serverErrorTransport) RoundTrip(req *http.Request) (*http.Response, error) {
return &http.Response{
StatusCode: http.StatusInternalServerError,
Body: io.NopCloser(bytes.NewReader([]byte{})),
}, nil
}

func TestValidateContext(t *testing.T) {
r, err := NewWithOptions(Options{
OCSPHTTPClient: &http.Client{},
Expand Down

0 comments on commit 6275ff6

Please sign in to comment.