From 03a22e7335493504bce9fb6d2e73ad08b200dd96 Mon Sep 17 00:00:00 2001 From: Dima May Date: Wed, 19 Jun 2024 15:12:51 +0000 Subject: [PATCH 1/3] #2490: run pki tests on push --- .github/workflows/build-and-test-ssl.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-test-ssl.yml b/.github/workflows/build-and-test-ssl.yml index b31db2788e..d9caa747d1 100644 --- a/.github/workflows/build-and-test-ssl.yml +++ b/.github/workflows/build-and-test-ssl.yml @@ -18,6 +18,7 @@ on: schedule: - cron: '0 7 * * *' workflow_dispatch: + push: # pull_request: # paths-ignore: # - 'README.md' From 3b9f158934213d4e5f2de1ccd818a2db3db5e08e Mon Sep 17 00:00:00 2001 From: Dima May Date: Wed, 19 Jun 2024 15:52:37 +0000 Subject: [PATCH 2/3] #2490: fixing tests --- .../java/skills/intTests/CachingSpec.groovy | 83 +++---------------- 1 file changed, 13 insertions(+), 70 deletions(-) diff --git a/service/src/test/java/skills/intTests/CachingSpec.groovy b/service/src/test/java/skills/intTests/CachingSpec.groovy index 32e4485388..b2b7032754 100644 --- a/service/src/test/java/skills/intTests/CachingSpec.groovy +++ b/service/src/test/java/skills/intTests/CachingSpec.groovy @@ -15,12 +15,14 @@ */ package skills.intTests +import groovy.util.logging.Slf4j import org.springframework.beans.factory.annotation.Autowired import org.springframework.core.io.ResourceLoader import org.springframework.core.io.support.ResourcePatternUtils import org.springframework.http.ResponseEntity import skills.intTests.utils.DefaultIntSpec +@Slf4j class CachingSpec extends DefaultIntSpec { @Autowired @@ -83,81 +85,22 @@ class CachingSpec extends DefaultIntSpec { def "assets should be cached"() { when: int count = 0 - getFileNamesFromClasspath("/public/assets/**").each { - println it - ResponseEntity responseEntity = skillsService.wsHelper.rawGet("/assets/${it}", [:]) - assert responseEntity.statusCode.is2xxSuccessful() - assert responseEntity.headers.getCacheControl() == "max-age=${defaultCacheAge}, must-revalidate, private" - count++ - } + List ignore = ["dashboard-prime"] + getFileNamesFromClasspath("/public/assets/**") + .findAll { !ignore.contains(it) } + .each { + String endpoint = "/assets/${it}".toString() + log.info("Checking endpoint: [${endpoint}]") + ResponseEntity responseEntity = skillsService.wsHelper.rawGet(endpoint, [:]) + assert responseEntity.statusCode.is2xxSuccessful(), "Failed for [${endpoint}] endpoint" + assert responseEntity.headers.getCacheControl() == "max-age=${defaultCacheAge}, must-revalidate, private", "Failed for [${endpoint}] endpoint" + count++ + } then: count > 0 } -// TODO: add back -// def "clientPortal index page should not be cached"() { -// when: -// ResponseEntity responseEntity = skillsService.wsHelper.rawGet("assets/clientPortal/index.html", [:]) -// -// then: -// responseEntity.statusCode.is2xxSuccessful() -// responseEntity.headers.getCacheControl() == "no-store" -// } -// -// def "clientPortal js resources should be cached"() { -// when: -// -// getFileNamesFromClasspath("/public/assets/clientPortal/js/**").each { -// ResponseEntity responseEntity = skillsService.wsHelper.rawGet("/assets/clientPortal/js/${it}", [:]) -// assert responseEntity.statusCode.is2xxSuccessful() -// assert responseEntity.headers.getCacheControl() == "max-age=7776000, must-revalidate, private" -// } -// -// then: -// true -// } -// -// def "clientPortal img resources should be cached"() { -// when: -// -// getFileNamesFromClasspath("/public/assets/clientPortal/img/**").each { -// ResponseEntity responseEntity = skillsService.wsHelper.rawGet("/assets/clientPortal/img/${it}", [:]) -// assert responseEntity.statusCode.is2xxSuccessful() -// assert responseEntity.headers.getCacheControl() == "max-age=1209600, must-revalidate, private" -// } -// -// then: -// true -// } -// -// def "clientPortal fonts resources should be cached"() { -// when: -// -// getFileNamesFromClasspath("/public/assets/clientPortal/fonts/**").each { -// ResponseEntity responseEntity = skillsService.wsHelper.rawGet("/assets/clientPortal/fonts/${it}", [:]) -// assert responseEntity.statusCode.is2xxSuccessful() -// assert responseEntity.headers.getCacheControl() == "max-age=1209600, must-revalidate, private" -// } -// -// then: -// true -// } -// -// def "clientPortal css resources should be cached"() { -// when: -// -// getFileNamesFromClasspath("/public/assets/clientPortal/css/**").each { -// ResponseEntity responseEntity = skillsService.wsHelper.rawGet("/assets/clientPortal/css/${it}", [:]) -// assert responseEntity.statusCode.is2xxSuccessful() -// assert responseEntity.headers.getCacheControl() == "max-age=7776000, must-revalidate, private" -// } -// -// then: -// true -// } - - private getFileNamesFromClasspath(String classpathPath) { return ResourcePatternUtils.getResourcePatternResolver(resourceLoader).getResources("classpath:${classpathPath}").collect { it.filename From a1ded002e57dce7556ceabd29417fec4dd76431f Mon Sep 17 00:00:00 2001 From: Dima May Date: Wed, 19 Jun 2024 16:13:33 +0000 Subject: [PATCH 3/3] 2490: fixing tests --- .github/scripts/runSubsetOfServiceTests.sh | 2 +- .github/workflows/build-and-test-email-confirmation.yml | 4 ++-- .github/workflows/build-and-test-night-service-tests.yml | 2 +- .github/workflows/build-and-test-rabbitmq.yml | 4 ++-- .github/workflows/build-and-test-ssl.yml | 2 +- .github/workflows/build-and-test.yml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/scripts/runSubsetOfServiceTests.sh b/.github/scripts/runSubsetOfServiceTests.sh index fe43b4d16f..bf471a0f85 100755 --- a/.github/scripts/runSubsetOfServiceTests.sh +++ b/.github/scripts/runSubsetOfServiceTests.sh @@ -82,7 +82,7 @@ if (( ${#integrationTests[@]} != 0 )); then fi if [ "$cachingSpec" == 'yes' ]; then - echo 'Found CachingSpec. Building dashboard & client-display...' + echo 'Found CachingSpec. Building dashboard' cd ../dashboard-prime npm run deploy # cd ../client-display diff --git a/.github/workflows/build-and-test-email-confirmation.yml b/.github/workflows/build-and-test-email-confirmation.yml index eb78a916ee..eae169a34a 100644 --- a/.github/workflows/build-and-test-email-confirmation.yml +++ b/.github/workflows/build-and-test-email-confirmation.yml @@ -53,9 +53,9 @@ jobs: repository: NationalSecurityAgency/skills-client path: skills-client - - uses: actions/setup-node@v2-beta + - uses: actions/setup-node@v3 with: - node-version: '14' + node-version: '20.11.0' - uses: actions/setup-java@v1 with: diff --git a/.github/workflows/build-and-test-night-service-tests.yml b/.github/workflows/build-and-test-night-service-tests.yml index bd2a54bd2f..0bd6eea6f1 100644 --- a/.github/workflows/build-and-test-night-service-tests.yml +++ b/.github/workflows/build-and-test-night-service-tests.yml @@ -46,7 +46,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: '14' + node-version: '20.11.0' - uses: actions/setup-java@v3 with: diff --git a/.github/workflows/build-and-test-rabbitmq.yml b/.github/workflows/build-and-test-rabbitmq.yml index 3b04bd84c6..d99141415f 100644 --- a/.github/workflows/build-and-test-rabbitmq.yml +++ b/.github/workflows/build-and-test-rabbitmq.yml @@ -61,9 +61,9 @@ jobs: - uses: actions/checkout@v2 - - uses: actions/setup-node@v2-beta + - uses: actions/setup-node@v3 with: - node-version: '14' + node-version: '20.11.0' - uses: actions/setup-java@v1 with: diff --git a/.github/workflows/build-and-test-ssl.yml b/.github/workflows/build-and-test-ssl.yml index d9caa747d1..602f011ef4 100644 --- a/.github/workflows/build-and-test-ssl.yml +++ b/.github/workflows/build-and-test-ssl.yml @@ -61,7 +61,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: '14' + node-version: '20.11.0' - uses: actions/setup-java@v3 with: diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 3c59f7e06d..376d0ef199 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -208,7 +208,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: '14' + node-version: '20.11.0' - uses: actions/setup-java@v3 with: