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

Add param to specify test underlays. #797

Merged
merged 3 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/workflows/regression-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ jobs:
env:
TEST_PROJECT_SA_KEY: ${{ secrets.TEST_PROJECT_SA_KEY }}
- name: Gradle Run Regression Tests Only
run: ./gradlew service:regressionTests --info --scan
run: ./gradlew service:regressionTests -PregressionTestUnderlays=cmssynpuf,aouSR2019q4r4 --info --scan
env:
DBMS: postgresql
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOOGLE_APPLICATION_CREDENTIALS: ../rendered/broad/tanagra_sa.json
TANAGRA_UNDERLAY_FILES: cmssynpuf_broad,aouSR2019q4r4_broad
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Run Regression Tests
on:
pull_request:
branches: [ '**' ]
workflow_dispatch:
inputs:
underlays:
description: 'Comma-separated list of underlays to test (e.g. cmssynpuf,aouSR2019q4r4)'
required: true
default: cmssynpuf,aouSR2019q4r4
env:
DEFAULT_UNDERLAYS: cmssynpuf,aouSR2019q4r4
TANAGRA_UNDERLAY_FILES: cmssynpuf_verily,aouSR2019q4r4_verily
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13.1
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
- name: Set up AdoptOpenJDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
- name: Initialize Postgres DB
env:
PGPASSWORD: postgres
run: psql -h 127.0.0.1 -U postgres -f ./tanagra/service/local-dev/local-postgres-init.sql
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: v1-${{ runner.os }}-gradle-${{ hashfiles('**/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}
restore-keys: v1-${{ runner.os }}-gradle-${{ hashfiles('**/gradle-wrapper.properties') }}
- name: Gradle Run Regression Tests Only
run: |
mkdir -p rendered/
echo "$GHA_SA_KEY" > rendered/gha_sa_key.json
export GOOGLE_APPLICATION_CREDENTIALS=$PWD/rendered/gha_sa_key.json
./tanagra/gradlew -p tanagra service:regressionTests -PregressionTestUnderlays="${UNDERLAYS:-$DEFAULT_UNDERLAYS}" --info --scan
env:
DBMS: postgresql
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GHA_SA_KEY: ${{ secrets.GCP_SA_KEY }}
UNDERLAYS: ${{ github.event.inputs.underlays }}
7 changes: 5 additions & 2 deletions service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,11 @@ tasks.withType(Test) {

// This System property is used to point at the directories that contain exported count regression test files.
// See bio.terra.tanagra.regression.QueryCountRegressionTest for how it's used.
if (project.findProperty("queryCountRegressionTestDirs")) {
systemProperty("QUERY_COUNT_REGRESSION_TEST_DIRS", project.findProperty("queryCountRegressionTestDirs"))
if (project.findProperty("regressionTestDirs")) {
systemProperty("REGRESSION_TEST_DIRS", project.findProperty("regressionTestDirs"))
}
if (project.findProperty("regressionTestUnderlays")) {
systemProperty("REGRESSION_TEST_UNDERLAYS", project.findProperty("regressionTestUnderlays"))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@
@Tag("regression-test")
public class QueryCountRegressionTest extends BaseSpringUnitTest {
private static final Logger LOGGER = LoggerFactory.getLogger(QueryCountRegressionTest.class);
private static final List<String> UNDERLAYS_TESTED_BY_DEFAULT =
List.of("cmssynpuf", "aouSR2019q4r4");

@Autowired private FeatureConfiguration featureConfiguration;
@Autowired private UnderlayService underlayService;
@Autowired private StudyService studyService;
Expand Down Expand Up @@ -176,21 +173,27 @@ void countsMatch(Path filePath) throws IOException {

@SuppressWarnings("PMD.UnusedPrivateMethod")
private static Stream<String> getTestFilePaths() throws FileNotFoundException {
String queryCountRegressionTestDirs = System.getProperty("QUERY_COUNT_REGRESSION_TEST_DIRS");
String regressionTestDirsParam = System.getProperty("REGRESSION_TEST_DIRS");
String regressionTestUnderlaysParam = System.getProperty("REGRESSION_TEST_UNDERLAYS");
String gradleProjectDir = System.getProperty("GRADLE_PROJECT_DIR");
LOGGER.info("QUERY_COUNT_REGRESSION_TEST_DIRS = {}", queryCountRegressionTestDirs);
LOGGER.info("REGRESSION_TEST_DIRS = {}", regressionTestDirsParam);
LOGGER.info("REGRESSION_TEST_UNDERLAYS = {}", regressionTestUnderlaysParam);
LOGGER.info("GRADLE_PROJECT_DIR = {}", gradleProjectDir);

List<Path> regressionTestDirs = new ArrayList<>();
if (queryCountRegressionTestDirs != null && !queryCountRegressionTestDirs.isEmpty()) {
List.of(queryCountRegressionTestDirs.split(",")).stream()
if (regressionTestDirsParam != null && !regressionTestDirsParam.isEmpty()) {
List.of(regressionTestDirsParam.split(",")).stream()
.forEach(dirName -> regressionTestDirs.add(Path.of(dirName)));
} else {
} else if (regressionTestUnderlaysParam != null && !regressionTestUnderlaysParam.isEmpty()) {
List<String> underlaySubDirs = List.of(regressionTestUnderlaysParam.split(","));
Path regressionParentDir =
Path.of(gradleProjectDir).resolve("src/test/resources/regression/");
UNDERLAYS_TESTED_BY_DEFAULT.stream()
underlaySubDirs.stream()
.forEach(
underlayName -> regressionTestDirs.add(regressionParentDir.resolve(underlayName)));
} else {
throw new IllegalArgumentException(
"No test directories or underlays specified. Use Gradle properties: -PregressionTestDirs for a directory, -PregressionTestUnderlays for an underlay-specific directory in the service/test/resources/regression sub-directory.");
}

List<String> regressionTestFiles = new ArrayList<>();
Expand All @@ -209,7 +212,11 @@ private static Stream<String> getTestFilePaths() throws FileNotFoundException {
}
});
if (regressionTestFiles.isEmpty()) {
throw new FileNotFoundException("No regression test files found");
throw new FileNotFoundException(
"No regression test files found: "
+ regressionTestDirs.stream()
.map(path -> path.toAbsolutePath().toString())
.collect(Collectors.joining(",")));
}
return regressionTestFiles.stream();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"underlay": "cmssynpuf",
"cohorts": [{
"displayName": "acetaminophen",
"criteriaGroupSections": [{
"criteriaGroups": [{
"criteria": [{
"selectorOrModifierName": "tanagra-drugs",
"selectionData": "CicKBBDD10QSDUFjZXRhbWlub3BoZW4aEGluZ3JlZGllbnRQZXJzb24SCQoFdF9hbnkiAA\u003d\u003d",
"pluginVersion": 0,
"pluginConfig": "{\n \"columns\": [\n {\n \"key\": \"name\",\n \"widthString\": \"100%\",\n \"title\": \"Concept name\"\n },\n {\n \"key\": \"id\",\n \"widthDouble\": 100,\n \"title\": \"Concept ID\"\n },\n {\n \"key\": \"standard_concept\",\n \"widthDouble\": 120,\n \"title\": \"Source/standard\"\n },\n {\n \"key\": \"vocabulary_t_value\",\n \"widthDouble\": 120,\n \"title\": \"Vocab\"\n },\n {\n \"key\": \"concept_code\",\n \"widthDouble\": 120,\n \"title\": \"Code\"\n },\n {\n \"key\": \"t_rollup_count\",\n \"widthDouble\": 120,\n \"title\": \"Roll-up count\"\n }\n ],\n \"hierarchyColumns\": [\n {\n \"key\": \"name\",\n \"widthString\": \"100%\",\n \"title\": \"Concept name\"\n },\n {\n \"key\": \"id\",\n \"widthDouble\": 100,\n \"title\": \"Concept ID\"\n },\n {\n \"key\": \"standard_concept\",\n \"widthDouble\": 120,\n \"title\": \"Source/standard\"\n },\n {\n \"key\": \"vocabulary_t_value\",\n \"widthDouble\": 120,\n \"title\": \"Vocab\"\n },\n {\n \"key\": \"concept_code\",\n \"widthDouble\": 120,\n \"title\": \"Code\"\n },\n {\n \"key\": \"t_rollup_count\",\n \"widthDouble\": 120,\n \"title\": \"Roll-up count\"\n }\n ],\n \"classificationEntityGroups\": [\n {\n \"id\": \"ingredientPerson\"\n }\n ],\n \"groupingEntityGroups\": [\n {\n \"id\": \"brandIngredient\",\n \"sortOrder\": {\n \"attribute\": \"name\",\n \"direction\": \"SORT_ORDER_DIRECTION_ASCENDING\"\n }\n }\n ]\n}",
"pluginName": "entityGroup"
}]
}],
"operator": "OR"
}]
}],
"dataFeatureSets": [{
"displayName": "demographics",
"criteria": [{
"predefinedId": "_demographics",
"selectionData": ""
}]
}],
"entityOutputCounts": [{
"entity": "person",
"numRows": "1100649"
}]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"underlay": "sd",
"cohorts": [{
"displayName": "acetaminophen",
"criteriaGroupSections": [{
"criteriaGroups": [{
"criteria": [{
"selectorOrModifierName": "tanagra-drugs",
"selectionData": "CicKBBDD10QSDWFjZXRhbWlub3BoZW4aEGluZ3JlZGllbnRQZXJzb24SCQoFdF9hbnkiAA\u003d\u003d",
"pluginVersion": 0,
"pluginConfig": "{\n \"columns\": [\n {\n \"key\": \"name\",\n \"widthString\": \"100%\",\n \"title\": \"Name\"\n },\n {\n \"key\": \"id\",\n \"widthDouble\": 120,\n \"title\": \"Concept ID\"\n },\n {\n \"key\": \"standard_concept\",\n \"widthDouble\": 180,\n \"title\": \"Source/standard\"\n },\n {\n \"key\": \"vocabulary_t_value\",\n \"widthDouble\": 120,\n \"title\": \"Vocab\"\n },\n {\n \"key\": \"concept_code\",\n \"widthDouble\": 120,\n \"title\": \"Code\"\n },\n {\n \"key\": \"t_rollup_count\",\n \"widthDouble\": 150,\n \"title\": \"Roll-up count\"\n }\n ],\n \"hierarchyColumns\": [\n {\n \"key\": \"name\",\n \"widthString\": \"100%\",\n \"title\": \"Name\"\n },\n {\n \"key\": \"id\",\n \"widthDouble\": 120,\n \"title\": \"Concept ID\"\n },\n {\n \"key\": \"standard_concept\",\n \"widthDouble\": 180,\n \"title\": \"Source/standard\"\n },\n {\n \"key\": \"vocabulary_t_value\",\n \"widthDouble\": 120,\n \"title\": \"Vocab\"\n },\n {\n \"key\": \"concept_code\",\n \"widthDouble\": 120,\n \"title\": \"Code\"\n },\n {\n \"key\": \"t_rollup_count\",\n \"widthDouble\": 150,\n \"title\": \"Roll-up count\"\n }\n ],\n \"classificationEntityGroups\": [\n {\n \"id\": \"ingredientPerson\"\n }\n ],\n \"groupingEntityGroups\": [\n {\n \"id\": \"brandIngredient\",\n \"sortOrder\": {\n \"attribute\": \"name\",\n \"direction\": \"SORT_ORDER_DIRECTION_ASCENDING\"\n }\n }\n ],\n \"multiSelect\": true\n}",
"pluginName": "entityGroup"
}]
}],
"operator": "OR"
}]
}],
"dataFeatureSets": [{
"displayName": "demographics",
"criteria": [{
"predefinedId": "_demographics",
"selectionData": ""
}]
}],
"entityOutputCounts": [{
"entity": "person",
"numRows": "1118027"
}]
}
Loading