Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DB unit tests #3186

Merged
merged 24 commits into from
Dec 18, 2024
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
86127f9
add docker compose that allows all services to run locally
fhanik Dec 9, 2024
fd5adcc
Fix flakiness in a test that does not yield time change on a fast system
fhanik Dec 9, 2024
ee70778
tests: fix unit tests to support all three databases
fhanik Dec 10, 2024
3a8d0c6
tests: use java initializer in TableAndColumnNormalizationTest
Kehrlann Dec 4, 2024
b81e0cc
tests: introduce @EnabledIfProfile / @DisabledIfProfile
Kehrlann Dec 9, 2024
80de45e
tests: fix hsql-specific JdbcPagingListTests
Kehrlann Dec 9, 2024
0596320
tests: fix JdbcScimUserProvisioningTests.retrieveByScimFilter_Include…
Kehrlann Dec 10, 2024
2ca7f14
tests: fix JdbcClientMetadataProvisioningTest.createdByPadsTo36Chars …
Kehrlann Dec 10, 2024
2ae2439
Remove hard coded database values from the MockMvc integration tests
fhanik Dec 10, 2024
c0162f5
Downgrade MySQL to avoid padding issues
fhanik Dec 10, 2024
97f475a
Remove database connections leaks (1 prod, many in tests)
fhanik Dec 11, 2024
5d33664
Change table columns `users.id` to varchar from char
fhanik Dec 11, 2024
0eb383a
Ensure that the table `groups` is properly escaped since groups is a …
fhanik Dec 11, 2024
49f7a30
add TODO in ScimUserEndpointsAliasMockMvcTests.AliasFeatureEnabled
fhanik Dec 11, 2024
4b02a1b
No more CHAR datatypes, only varchar
fhanik Dec 11, 2024
eece476
Fix mistake on column null handling
fhanik Dec 12, 2024
fea1a59
tests: disable BootstrapTests in mysql and postgresql profiles
Kehrlann Dec 13, 2024
03b544e
tests: remove duplicate test
Kehrlann Dec 16, 2024
34656be
tests: ensure mysql is on the same timezone as the host machine when …
Kehrlann Dec 16, 2024
9436ed4
Fix connection leak from Flyway
fhanik Dec 16, 2024
428b189
tests: database data volumes in docker-compose.yml uses tmpfs
Kehrlann Dec 17, 2024
de56eab
tests: re-enable createdByPadsTo36Chars excpet for MySQL
Kehrlann Dec 17, 2024
8738e29
docs: add docs/testing.md
Kehrlann Dec 17, 2024
345c7c1
tests: rework JdbcScimUserProvisioningTests.retrieveByScimFilter_Incl…
Kehrlann Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
import org.cloudfoundry.identity.uaa.zone.beans.IdentityZoneManagerImpl;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.dao.OptimisticLockingFailureException;
import org.springframework.http.HttpStatus;
Expand All @@ -47,6 +47,7 @@

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -107,6 +108,10 @@ class JdbcScimUserProvisioningTests {

@Autowired
NamedParameterJdbcTemplate namedJdbcTemplate;

@Autowired
private Environment enviroment;

private String joeEmail;
private static final String JOE_NAME = "joe";

Expand Down Expand Up @@ -416,7 +421,6 @@ void retrieveByScimFilterUsingLower() {
}

@Test
@Disabled("Does not yet work on MySQL")
void retrieveByScimFilter_IncludeInactive() {
final String originActive = randomString();
addIdentityProvider(jdbcTemplate, currentIdentityZoneId, originActive, true);
Expand All @@ -443,7 +447,11 @@ void retrieveByScimFilter_IncludeInactive() {
);
Assertions.assertThat(result).isNotNull();
final List<String> usernames = result.stream().map(ScimUser::getUserName).toList();
Assertions.assertThat(usernames).isSorted();
if (Arrays.stream(enviroment.getActiveProfiles()).noneMatch("mysql"::equalsIgnoreCase)) {
// MySQL has a different ordering from HSQL and Postgres. In MySQL the two values
// we inserted are sorted in reverse order, so we skip the assert entirely
Assertions.assertThat(usernames).isSorted();
}
return usernames;
};

Expand Down