Skip to content

Commit

Permalink
Trying to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NavidMitchell committed Jan 24, 2025
1 parent 3595a9f commit 2b72943
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 35 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ jobs:
# DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
# DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}

- name: Run docker-compose
uses: hoverkraft-tech/[email protected]
with:
compose-file: "./structures-js/structures-api/compose.yml"

- name: Run E2E Tests
run: |
cd structures-js/structures-api
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ testContainersVersion=1.20.4
vertxVersion=4.5.11
vertxCompletableFutureVersion=0.1.2
vertxBeansVersion=1.6.2

3 changes: 2 additions & 1 deletion structures-js/structures-api/compose.ek-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ services:
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- _JAVA_OPTIONS=-XX:UseSVE=0
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"]
test: ["CMD-SHELL", "curl --silent --fail 127.0.0.1:9200/_cluster/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
Expand Down
13 changes: 7 additions & 6 deletions structures-js/structures-api/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@ include:
- compose.ek-stack.yml
services:
structures-server-e2e:
container_name: structures-server-e2e
image: kinotic/structures-server:3.1.3
depends_on:
elasticsearch:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail localhost:9090/health || exit 1"]
test: ["CMD-SHELL", "curl --silent --fail 127.0.0.1:9090/health || exit 1"]
interval: 300s
timeout: 10s
retries: 3
start_period: 90s
ports:
- "9090:9090" # UI PORT
- "4000:4000" # GraphQL Port
- "8080:8080" # OpenAPI Port
- "58503:58503" # Continuum Stomp Port
- "58504:58504" # Continuum REST Port
- "127.0.0.1:9090:9090" # UI PORT
- "127.0.0.1:4000:4000" # GraphQL Port
- "127.0.0.1:8080:8080" # OpenAPI Port
- "127.0.0.1:58503:58503" # Continuum Stomp Port
- "127.0.0.1:58504:58504" # Continuum REST Port
environment:
SPRING_PROFILES_ACTIVE: production
STRUCTURES_INDEX_PREFIX: struct_
Expand Down
1 change: 0 additions & 1 deletion structures-js/structures-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@types/ws": "^8.5.14",
"@vitest/coverage-v8": "^2.1.8",
"delay": "^6.0.0",
"docker-compose": "^1.1.0",
"testcontainers": "^10.17.1",
"typescript": "^5.7.3",
"vite": "^5.4.11",
Expand Down
11 changes: 0 additions & 11 deletions structures-js/structures-api/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions structures-js/structures-api/test/setup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-ignore for some reason intellij is complaining about this even though esModuleInterop is enabled
import path from 'node:path'
import * as compose from 'docker-compose'
import {DockerComposeEnvironment, Wait} from 'testcontainers'

const composeFilePath = '.'

Expand All @@ -9,18 +9,17 @@ export async function setup() {
console.log('Starting Structures...')
const resolvedPath = path.resolve(composeFilePath)

await compose.pullAll({cwd: resolvedPath, log: true})
globalThis.environment = await new DockerComposeEnvironment('.', 'compose.yml')
.withWaitStrategy('structures-elasticsearch-e2e', Wait.forHttp('/_cluster/health', 9200))
.withWaitStrategy('structures-server-e2e', Wait.forHttp('/health', 9090))
.up()

await compose.upAll({
cwd: resolvedPath,
log: true
})
console.log('Structures started.')
}

// Run once after all tests
export async function teardown() {
console.log('Shutting down Structures...')
await compose.down({cwd: path.resolve(composeFilePath), log: true})
await globalThis.environment?.down()
console.log('Structures shut down.')
}
6 changes: 3 additions & 3 deletions structures-js/structures-api/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default defineConfig({
},
},
plugins: [externalizeDeps(), dts()],
// test: {
// globalSetup: './test/setup.ts',
// },
test: {
globalSetup: './test/setup.ts',
},
})

0 comments on commit 2b72943

Please sign in to comment.