Skip to content

Commit

Permalink
SNOW-1446174: Accept 513 next to 403 for OCSP tests (#1801)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dprzybysz authored Jun 24, 2024
1 parent ab4880c commit 66279ca
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import net.snowflake.client.category.TestCategoryConnection;
import net.snowflake.client.core.SFOCSPException;
import net.snowflake.client.core.SFTrustManager;
import org.hamcrest.Matcher;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
Expand Down Expand Up @@ -108,7 +109,7 @@ public void testValidityExpiredOCSPResponseFailOpen() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), containsString("HTTP status=403"));
assertThat(ex.getMessage(), httpStatus403Or513());
assertNull(ex.getCause());
}
}
Expand Down Expand Up @@ -146,7 +147,7 @@ public void testNoOCSPResponderURLFailOpen() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), containsString("HTTP status=403"));
assertThat(ex.getMessage(), httpStatus403Or513());
assertNull(ex.getCause());
}
}
Expand Down Expand Up @@ -183,7 +184,7 @@ public void testValidityExpiredOCSPResponseInsecure() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), containsString("HTTP status=403"));
assertThat(ex.getMessage(), httpStatus403Or513());
assertNull(ex.getCause());
}
}
Expand All @@ -198,7 +199,7 @@ public void testCertAttachedInvalidFailOpen() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), containsString("HTTP status=403"));
assertThat(ex.getMessage(), httpStatus403Or513());
assertNull(ex.getCause());
}
}
Expand Down Expand Up @@ -234,7 +235,7 @@ public void testUnknownOCSPCertFailOpen() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), containsString("HTTP status=403"));
assertThat(ex.getMessage(), httpStatus403Or513());
assertNull(ex.getCause());
}
}
Expand Down Expand Up @@ -293,7 +294,7 @@ public void testOCSPCacheServerTimeoutFailOpen() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), containsString("HTTP status=403"));
assertThat(ex.getMessage(), httpStatus403Or513());
assertNull(ex.getCause());
}
}
Expand Down Expand Up @@ -332,7 +333,7 @@ public void testOCSPResponderTimeoutFailOpen() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), containsString("HTTP status=403"));
assertThat(ex.getMessage(), httpStatus403Or513());
assertNull(ex.getCause());
}
}
Expand Down Expand Up @@ -368,7 +369,7 @@ public void testOCSPResponder403FailOpen() {
} catch (SQLException ex) {
assertThat(ex, instanceOf(SnowflakeSQLException.class));
assertThat(ex.getErrorCode(), equalTo(NETWORK_ERROR.getMessageCode()));
assertThat(ex.getMessage(), containsString("HTTP status=403"));
assertThat(ex.getMessage(), httpStatus403Or513());
assertNull(ex.getCause());
}
}
Expand Down Expand Up @@ -429,4 +430,8 @@ public void testWrongHost() {
instanceOf(SSLHandshakeException.class)));
}
}

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

0 comments on commit 66279ca

Please sign in to comment.