Skip to content

Commit

Permalink
SNOW-1759523: Accept 404 for OCSP tests with fakeaccount (#1935)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dprzybysz authored Oct 23, 2024
1 parent ea6abe1 commit b1d7d9d
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void testValidityExpiredOCSPResponseFailOpen() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), httpStatus403Or513());
assertThat(ex.getMessage(), httpStatus403Or404Or513());
assertNull(ex.getCause());
}
}
Expand Down Expand Up @@ -148,7 +148,7 @@ public void testNoOCSPResponderURLFailOpen() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), httpStatus403Or513());
assertThat(ex.getMessage(), httpStatus403Or404Or513());
assertNull(ex.getCause());
}
}
Expand Down Expand Up @@ -185,7 +185,7 @@ public void testValidityExpiredOCSPResponseInsecure() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), httpStatus403Or513());
assertThat(ex.getMessage(), httpStatus403Or404Or513());
assertNull(ex.getCause());
}
}
Expand All @@ -200,7 +200,7 @@ public void testCertAttachedInvalidFailOpen() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), httpStatus403Or513());
assertThat(ex.getMessage(), httpStatus403Or404Or513());
assertNull(ex.getCause());
}
}
Expand Down Expand Up @@ -236,7 +236,7 @@ public void testUnknownOCSPCertFailOpen() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), httpStatus403Or513());
assertThat(ex.getMessage(), httpStatus403Or404Or513());
assertNull(ex.getCause());
}
}
Expand Down Expand Up @@ -295,7 +295,7 @@ public void testOCSPCacheServerTimeoutFailOpen() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), httpStatus403Or513());
assertThat(ex.getMessage(), httpStatus403Or404Or513());
assertNull(ex.getCause());
}
}
Expand Down Expand Up @@ -334,7 +334,7 @@ public void testOCSPResponderTimeoutFailOpen() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), httpStatus403Or513());
assertThat(ex.getMessage(), httpStatus403Or404Or513());
assertNull(ex.getCause());
}
}
Expand Down Expand Up @@ -370,7 +370,7 @@ public void testOCSPResponder403FailOpen() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), httpStatus403Or513());
assertThat(ex.getMessage(), httpStatus403Or404Or513());
assertNull(ex.getCause());
}
}
Expand Down Expand Up @@ -448,7 +448,10 @@ public void testWrongHost() throws InterruptedException {
}
}

private static Matcher<String> httpStatus403Or513() {
return anyOf(containsString("HTTP status=403"), containsString("HTTP status=513"));
private static Matcher<String> httpStatus403Or404Or513() {
return anyOf(
containsString("HTTP status=403"),
containsString("HTTP status=404"),
containsString("HTTP status=513"));
}
}

0 comments on commit b1d7d9d

Please sign in to comment.