diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a8aa140..599cf76 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -26,6 +26,55 @@ jobs: run --rm --user root zorm-test-github-actions + vallum: + runs-on: ubuntu-latest + services: + postgres: + image: postgres + ports: + - 5432:5432 + env: + POSTGRES_PASSWORD: postgres + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + - name: backward-compatibility-test + run: ./vallum/backward-compatibility-test.sh + env: + POSTGRES_URL: jdbc:postgresql://localhost:5432/postgres + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + BASE_URL: http://localhost:8082 + CORS_ALLOW_ORIGIN_PATTERN: 'http://localhost:\d{2,5}' + # Keycloak test realm JWK + ACCESS_TOKEN_JWK: | + { + "kid": "n-X5BeXFe6pIXhDBsDu2mQ2VYc23RSZCFRU5Y6IuzC8", + "kty": "OKP", + "alg": "EdDSA", + "use": "sig", + "crv": "Ed25519", + "x": "ILokSbk8EKH-Q1aWo_TguuDRccoSVfEbmGSbm5gcn5I" + } + USER_ID: f9eee559-7bd8-4a53-99cf-aaef36dad8a1 + CLIENT_ID: test-client-ztor-api + CLIENT_SECRET: ${{ secrets.KEYCLOAK_TEST_CLIENT_SECRET }} + - name: upload-test-results + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-results + path: ./vallum/build/reports/tests/test/ + # Tests without a database gradle: runs-on: ubuntu-latest diff --git a/compose.yaml b/compose.yaml index 80db9aa..5c561e6 100644 --- a/compose.yaml +++ b/compose.yaml @@ -181,7 +181,7 @@ services: vallum-test: extends: service: gradle-base - command: vallum:test + entrypoint: ./vallum/backward-compatibility-test.sh volumes: - gradle-vallum-test-cache:/home/gradle/.gradle depends_on: diff --git a/frontend/src/components/company-survey-v2/time-series/interval-dropdown.tsx b/frontend/src/components/company-survey-v2/time-series/interval-dropdown.tsx deleted file mode 100644 index e15fa8b..0000000 --- a/frontend/src/components/company-survey-v2/time-series/interval-dropdown.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import {FunctionComponent} from "react" -import {Dropdown} from "primereact/dropdown" -import {isoStringToDateTimeUnit, dateTimeUnitToIsoString} from "zero-zummon" -import {SelectItem, SelectItemOptionsType} from "primereact/selectitem" - -const options: SelectItemOptionsType = [ - { - value: "PT15M", - label: "Kwartier", - }, - { - value: "P1D", - label: "Dag", - }, - { - value: "P1M", - label: "Maand", - }, -] - -export const IntervalDropdown: FunctionComponent<{ - timeStep: any, - setTimeStep: (timeStep: any) => void -}> = ({timeStep, setTimeStep}) => { - - return ( - setTimeStep(isoStringToDateTimeUnit(event.value))}/> - ) -} diff --git a/frontend/src/components/company-survey-v2/time-series/time-series-textarea.tsx b/frontend/src/components/company-survey-v2/time-series/time-series-textarea.tsx index 2c8e923..cd50c3d 100644 --- a/frontend/src/components/company-survey-v2/time-series/time-series-textarea.tsx +++ b/frontend/src/components/company-survey-v2/time-series/time-series-textarea.tsx @@ -7,7 +7,6 @@ import {LabelRow} from "../generic/label-row" import {displayTimeZone, kotlinInstantToJsJodaInstant, prettyPrint} from "./time-series-util" import {Dropdown} from "primereact/dropdown" import {InputText} from "primereact/inputtext" -import {IntervalDropdown} from "./interval-dropdown" const placeholder = ` bijvoorbeeld: @@ -51,9 +50,6 @@ export const TimeSeriesTextarea: FunctionComponent<{timeSeries: TimeSeries, setT - - setTimeSeriesImpl(internalTimeSeries.withTimeStep(timeStep))} /> - ) { .start(wait = true) } -fun interface StopZtor { - fun stop(): Unit -} - -fun startTestServer(): StopZtor { - val server = embeddedServer(Netty, port = 8082, host = "0.0.0.0", module = Application::vallumMinimal) - .start(wait = false) - - return StopZtor { server.stop(1000, 1000) } -} - -fun Application.vallumMinimal() { - configureHTTP() - configureMonitoring() - configureSerialization() - configureAuthentication() - val db = configureDatabases() - configureRouting() - configureStatusPages() -} - fun Application.module() { configureHTTP() configureMonitoring() diff --git a/ztor/src/main/kotlin/com/zenmo/ztor/TestServer.kt b/ztor/src/main/kotlin/com/zenmo/ztor/TestServer.kt new file mode 100644 index 0000000..f7963d7 --- /dev/null +++ b/ztor/src/main/kotlin/com/zenmo/ztor/TestServer.kt @@ -0,0 +1,28 @@ +package com.zenmo.ztor + +import com.zenmo.ztor.plugins.* +import io.ktor.server.application.* +import io.ktor.server.engine.* +import io.ktor.server.netty.* + +fun interface StopZtor { + fun stop(): Unit +} + +@JvmOverloads +fun startTestServer(port: Int = 8082): StopZtor { + val server = embeddedServer(Netty, port = port, host = "0.0.0.0", module = Application::vallumMinimal) + .start(wait = false) + + return StopZtor { server.stop(1000, 1000) } +} + +fun Application.vallumMinimal() { + configureHTTP() + configureMonitoring() + configureSerialization() + configureAuthentication() + val db = configureDatabases() + configureRouting() + configureStatusPages() +}