Skip to content

Commit

Permalink
chore: enable debugging for integration tests (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
karenc-bq authored Mar 11, 2024
1 parent 97acc1a commit c1f71aa
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 16 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"connect": "npx tsx tests/connectbenchmarks.ts",
"format": "prettier . --write --config .prettierrc",
"integration": "jest --config=jest.integration.config.json",
"debug-integration": "node --inspect-brk=0.0.0.0:5005 ./node_modules/jest/bin/jest.js --config=jest.integration.config.json --runInBand",
"lint": "eslint --fix --ext .ts .",
"prepare": "husky install",
"test": "jest --config=jest.unit.config.json"
Expand Down
22 changes: 22 additions & 0 deletions tests/integration/host/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,25 @@ tasks.register<Test>("debug-aurora") {
systemProperty("exclude-performance", "true")
}
}

tasks.register<Test>("debug-aurora-pg") {
group = "verification"
filter.includeTestsMatching("integration.host.TestRunner.debugTests")
doFirst {
systemProperty("exclude-docker", "true")
systemProperty("exclude-performance", "true")
systemProperty("exclude-mysql-driver", "true")
systemProperty("exclude-mysql-engine", "true")
}
}

tasks.register<Test>("debug-aurora-mysql") {
group = "verification"
filter.includeTestsMatching("integration.host.TestRunner.debugTests")
doFirst {
systemProperty("exclude-docker", "true")
systemProperty("exclude-performance", "true")
systemProperty("exclude-pg-driver", "true")
systemProperty("exclude-pg-engine", "true")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public void runTest(GenericContainer<?> container, String testFolder, TestEnviro
execInContainer(container, consumer, "printenv", "TEST_ENV_DESCRIPTION");
execInContainer(container, consumer, "npm", "install", "--no-save");


final String filter = System.getenv("FILTER");

Long exitCode;
Expand All @@ -107,21 +106,17 @@ public void debugTest(GenericContainer<?> container, String testFolder, TestEnvi
execInContainer(container, consumer, "printenv", "TEST_ENV_DESCRIPTION");
execInContainer(container, consumer, "npm", "install", "--no-save");

// Long exitCode;
// String reportSetting = String.format(
// "--html=./tests/integration/container/reports/%s.html",
// config.getPrimaryInfo());
// System.out.println("\n\n Starting debugpy - you may now attach to the
// debugger from vscode...\n\n");
// exitCode = execInContainer(container, consumer,
// "poetry", "run", "python", "-Xfrozen_modules=off", "-m", "debugpy",
// "--listen", "0.0.0.0:5005",
// "--wait-for-client",
// "./tests/integration/container/scripts/debug_integration_vscode.py",
// System.getenv("FILTER"), reportSetting, testFolder);

// System.out.println("==== Container console feed ==== <<<<");
// assertEquals(0, exitCode, "Some tests failed.");
final String filter = System.getenv("FILTER");

Long exitCode;
if (filter != null) {
exitCode = execInContainer(container, consumer, "npm", "run", "debug-integration", "--", "-t", filter);
} else {
exitCode = execInContainer(container, consumer, "npm", "run", "debug-integration");
}

System.out.println("==== Container console feed ==== <<<<");
assertEquals(0, exitCode, "Some tests failed.");
}

public GenericContainer<?> createTestContainer(String dockerImageName, String testContainerImageName) {
Expand Down

0 comments on commit c1f71aa

Please sign in to comment.