diff --git a/.github/workflows/hermetic.yml b/.github/workflows/hermetic.yml index a9edaff5..bb99efd5 100644 --- a/.github/workflows/hermetic.yml +++ b/.github/workflows/hermetic.yml @@ -13,7 +13,7 @@ on: type: string description: Path regex passed to Jest to select which tests to run required: true - default: fast + default: correctness/fast env: CARGO_TERM_COLOR: always @@ -127,12 +127,12 @@ jobs: chmod +x ./bin/hermetic-driver # For scheduled events, "test_selector" will be null, so default to running all tests. - test_selector=${{ github.event.inputs.test_selector || '.' }} + test_selector=${{ github.event.inputs.test_selector || 'correctness' }} # For PR and merge group events, run only "fast" tests. # Note it is not possible to override "test_selector" for these types of events. if [[ ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }} == 'true' ]]; then - test_selector="fast" + test_selector="correctness/fast" fi make TEST_SELECTOR="$test_selector" HERMETIC_CMD=./bin/hermetic-driver hermetic-tests run-migration-tests: diff --git a/.github/workflows/hermetic_long_lived.yml b/.github/workflows/hermetic_long_lived.yml index 43e96ccc..60526b00 100644 --- a/.github/workflows/hermetic_long_lived.yml +++ b/.github/workflows/hermetic_long_lived.yml @@ -9,7 +9,7 @@ on: type: string description: Path regex passed to Jest to select which tests to run required: true - default: fast + default: correctness/fast env: CARGO_TERM_COLOR: always @@ -122,17 +122,52 @@ jobs: chmod +x ./bin/hermetic-driver # For scheduled events, "test_selector" will be null, so default to running all tests. - test_selector=${{ github.event.inputs.test_selector || '.' }} + test_selector=${{ github.event.inputs.test_selector || 'correctness' }} # Clear the test suffix and set a 2 week TTL so that the latest suite image runs against the same long-lived # networks for 2 weeks before the network is cleaned up and recreated. make TEST_SELECTOR="$test_selector" HERMETIC_SUFFIX= HERMETIC_TTL=1209600 HERMETIC_CMD=./bin/hermetic-driver hermetic-tests + run-migration-tests: + name: Test Migrations + runs-on: ubuntu-latest + environment: test + needs: + - build-driver + - publish-suite + - generate-matrix #Needed to know the BUILD_TAG + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Setup GKE auth + uses: 'google-github-actions/auth@v1' + with: + credentials_json: ${{ secrets.GKE_SA_KEY }} + - + name: Get GKE credentials + uses: 'google-github-actions/get-gke-credentials@v1' + with: + cluster_name: ${{ vars.GKE_CLUSTER }} + location: ${{ vars.GKE_ZONE }} + - uses: actions/download-artifact@master + with: + name: hermetic-driver + path: ./bin + - + name: Test ${{ matrix.networks }} + run: | + set -euxo pipefail + export BUILD_TAG=${{ needs.generate-matrix.outputs.build_tag }} + chmod +x ./bin/hermetic-driver + make HERMETIC_CMD=./bin/hermetic-driver migration-tests + collect-results: name: Long-Lived Hermetic Test Results if: ${{ always() }} runs-on: ubuntu-latest - needs: [run-tests] + needs: [run-tests, run-migration-tests] steps: - run: exit 1 # see https://stackoverflow.com/a/67532120/4907315 diff --git a/.github/workflows/run-durable.yml b/.github/workflows/run-durable.yml index a81bd6d5..aeccbe1e 100644 --- a/.github/workflows/run-durable.yml +++ b/.github/workflows/run-durable.yml @@ -23,7 +23,7 @@ on: type: string description: Path regex passed to Jest to select which tests to run required: true - default: fast + default: correctness/fast # The "job_id" input is needed for the CD manager to be able to track a workflow run as part of a CD manager job. # The GitHub API does not return the workflow run ID for a run created via the API. In order to track a workflow, # we're forced to inject the CD manager job ID via a tagged job step. This allows the CD manager to lookup diff --git a/.github/workflows/schedule-durable.yml b/.github/workflows/schedule-durable.yml index 28aa8d6d..dee205ec 100644 --- a/.github/workflows/schedule-durable.yml +++ b/.github/workflows/schedule-durable.yml @@ -19,7 +19,7 @@ on: type: string description: Path regex passed to Jest to select which tests to run required: true - default: fast + default: correctness/fast env: AWS_REGION: ${{ secrets.AWS_REGION }} @@ -92,10 +92,10 @@ jobs: run: | # For scheduled events, "test_selector" will be null. Run all tests for QA but only "fast" ones for other # envs. - test_selector=${{ github.event.inputs.test_selector || 'fast' }} + test_selector=${{ github.event.inputs.test_selector || 'correctness/fast' }} if [[ ${{ github.event.inputs.test_selector == null }} == 'true' ]]; then if [[ ${{ matrix.network == 'qa' }} == 'true' ]]; then - test_selector="." + test_selector="correctness" fi fi make TEST_SELECTOR="$test_selector" schedule-durable-tests diff --git a/Makefile b/Makefile index d612051b..49f52db3 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ DURABLE_ENV ?= dev DURABLE_TEST_BRANCH ?= main # Test selector -TEST_SELECTOR ?= . +TEST_SELECTOR ?= correctness PNPM = pnpm diff --git a/ci-scripts/schedule_durable_tests.sh b/ci-scripts/schedule_durable_tests.sh index c6f2a04b..f31352a8 100755 --- a/ci-scripts/schedule_durable_tests.sh +++ b/ci-scripts/schedule_durable_tests.sh @@ -7,7 +7,7 @@ ttl=$(date +%s -d "14 days") tag=${BUILD_TAG-latest} branch=${TEST_BRANCH-main} network=${1-dev} -test_selector=${2-.} +test_selector=${2-correctness} docker run --rm -i \ -e "AWS_REGION=$AWS_REGION" \ diff --git a/suite/Dockerfile b/suite/Dockerfile index eaa591b0..bffa01a4 100644 --- a/suite/Dockerfile +++ b/suite/Dockerfile @@ -15,6 +15,6 @@ RUN pnpm install COPY src/ ./src # Select all tests by default -ENV TEST_SELECTOR "." +ENV TEST_SELECTOR "correctness" ENTRYPOINT ["/app/entrypoint.sh", "run", "test", "--forceExit", "--testPathPattern", "$TEST_SELECTOR"] diff --git a/suite/src/__tests__/fast/anchor.test.ts b/suite/src/__tests__/correctness/fast/anchor.test.ts similarity index 95% rename from suite/src/__tests__/fast/anchor.test.ts rename to suite/src/__tests__/correctness/fast/anchor.test.ts index afa82a2e..414ad8f8 100644 --- a/suite/src/__tests__/fast/anchor.test.ts +++ b/suite/src/__tests__/correctness/fast/anchor.test.ts @@ -2,8 +2,8 @@ import { AnchorStatus, StreamUtils } from '@ceramicnetwork/common' import { afterAll, beforeAll, describe, expect, test } from '@jest/globals' import { DateTime } from 'luxon' -import { newCeramic } from '../../utils/ceramicHelpers.js' -import * as helpers from '../../utils/dynamoDbHelpers.js' +import { newCeramic } from '../../../utils/ceramicHelpers.js' +import * as helpers from '../../../utils/dynamoDbHelpers.js' const ComposeDbUrls = String(process.env.COMPOSEDB_URLS).split(',') diff --git a/suite/src/__tests__/fast/composedb-model-sync.test.ts b/suite/src/__tests__/correctness/fast/composedb-model-sync.test.ts similarity index 92% rename from suite/src/__tests__/fast/composedb-model-sync.test.ts rename to suite/src/__tests__/correctness/fast/composedb-model-sync.test.ts index 2104e19a..c01a0ed6 100644 --- a/suite/src/__tests__/fast/composedb-model-sync.test.ts +++ b/suite/src/__tests__/correctness/fast/composedb-model-sync.test.ts @@ -1,11 +1,11 @@ import { ComposeClient } from '@composedb/client' import { beforeAll, describe, test, expect } from '@jest/globals' import { Composite } from '@composedb/devtools' -import { loadDocumentOrTimeout, newCeramic } from '../../utils/ceramicHelpers.js' -import { createDid } from '../../utils/didHelper.js' -import { BasicSchema } from '../../graphql-schemas/basicSchema' +import { loadDocumentOrTimeout, newCeramic } from '../../../utils/ceramicHelpers.js' +import { createDid } from '../../../utils/didHelper.js' +import { BasicSchema } from '../../../graphql-schemas/basicSchema' import { StreamID } from '@ceramicnetwork/streamid' -import { waitForDocument } from '../../utils/composeDbHelpers.js' +import { waitForDocument } from '../../../utils/composeDbHelpers.js' const ComposeDbUrls = String(process.env.COMPOSEDB_URLS).split(',') const adminSeeds = String(process.env.COMPOSEDB_ADMIN_DID_SEEDS).split(',') diff --git a/suite/src/__tests__/fast/data-feed-api.test.ts b/suite/src/__tests__/correctness/fast/data-feed-api.test.ts similarity index 96% rename from suite/src/__tests__/fast/data-feed-api.test.ts rename to suite/src/__tests__/correctness/fast/data-feed-api.test.ts index b7a5298e..d251293f 100644 --- a/suite/src/__tests__/fast/data-feed-api.test.ts +++ b/suite/src/__tests__/correctness/fast/data-feed-api.test.ts @@ -1,11 +1,11 @@ import { describe, test, beforeAll, expect } from '@jest/globals' -import { newCeramic, waitForAnchor } from '../../utils/ceramicHelpers.js' -import { createDid } from '../../utils/didHelper.js' -import { EventAccumulator } from '../../utils/common.js' +import { newCeramic, waitForAnchor } from '../../../utils/ceramicHelpers.js' +import { createDid } from '../../../utils/didHelper.js' +import { EventAccumulator } from '../../../utils/common.js' import { StreamID } from '@ceramicnetwork/streamid' import { Model } from '@ceramicnetwork/stream-model' import { ModelInstanceDocument, ModelInstanceDocumentMetadataArgs } from '@ceramicnetwork/stream-model-instance' -import { LIST_MODEL_DEFINITION } from '../../models/modelConstants' +import { LIST_MODEL_DEFINITION } from '../../../models/modelConstants' import { CeramicClient } from '@ceramicnetwork/http-client' import { CommonTestUtils as TestUtils } from '@ceramicnetwork/common-test-utils' import { EventSource } from 'cross-eventsource' diff --git a/suite/src/__tests__/fast/garbage-collect.test.ts b/suite/src/__tests__/correctness/fast/garbage-collect.test.ts similarity index 94% rename from suite/src/__tests__/fast/garbage-collect.test.ts rename to suite/src/__tests__/correctness/fast/garbage-collect.test.ts index 2aec14aa..100cda86 100644 --- a/suite/src/__tests__/fast/garbage-collect.test.ts +++ b/suite/src/__tests__/correctness/fast/garbage-collect.test.ts @@ -4,8 +4,8 @@ import { afterAll, beforeAll, describe, test } from '@jest/globals' // Internal dependencies import CeramicClient from '@ceramicnetwork/http-client' import { StreamID } from '@ceramicnetwork/streamid' -import { newCeramic } from '../../utils/ceramicHelpers.js' -import * as helpers from '../../utils/dynamoDbHelpers.js' +import { newCeramic } from '../../../utils/ceramicHelpers.js' +import * as helpers from '../../../utils/dynamoDbHelpers.js' // Environment variables const ComposeDbUrls = String(process.env.COMPOSEDB_URLS).split(',') diff --git a/suite/src/__tests__/fast/get-events.test.ts b/suite/src/__tests__/correctness/fast/get-events.test.ts similarity index 98% rename from suite/src/__tests__/fast/get-events.test.ts rename to suite/src/__tests__/correctness/fast/get-events.test.ts index 5e4a5c74..58b31dda 100644 --- a/suite/src/__tests__/fast/get-events.test.ts +++ b/suite/src/__tests__/correctness/fast/get-events.test.ts @@ -5,7 +5,7 @@ import { generateRandomEvent, generateRandomRawEvent, encodeRawEvent, -} from '../../utils/rustCeramicHelpers' +} from '../../../utils/rustCeramicHelpers' import { StreamID, randomCID } from '@ceramicnetwork/streamid' const CeramicUrls = String(process.env.CERAMIC_URLS).split(',') diff --git a/suite/src/__tests__/fast/helpers.test.ts b/suite/src/__tests__/correctness/fast/helpers.test.ts similarity index 97% rename from suite/src/__tests__/fast/helpers.test.ts rename to suite/src/__tests__/correctness/fast/helpers.test.ts index a2730fbd..1b037595 100644 --- a/suite/src/__tests__/fast/helpers.test.ts +++ b/suite/src/__tests__/correctness/fast/helpers.test.ts @@ -1,7 +1,7 @@ import { StreamID } from '@ceramicnetwork/streamid' import { afterAll, beforeAll, describe, expect, test } from '@jest/globals' -import * as helpers from '../../utils/dynamoDbHelpers.js' +import * as helpers from '../../../utils/dynamoDbHelpers.js' const streamID0 = StreamID.fromString( 'kjzl6cwe1jw149mj7gw90a40vf9qoipv1gthagyzxzjrg8pp9htbdbvu2er1wan', diff --git a/suite/src/__tests__/fast/longevity.test.ts b/suite/src/__tests__/correctness/fast/longevity.test.ts similarity index 96% rename from suite/src/__tests__/fast/longevity.test.ts rename to suite/src/__tests__/correctness/fast/longevity.test.ts index 0eea9817..488815be 100644 --- a/suite/src/__tests__/fast/longevity.test.ts +++ b/suite/src/__tests__/correctness/fast/longevity.test.ts @@ -2,8 +2,8 @@ import { AnchorStatus, StreamUtils } from '@ceramicnetwork/common' import { StreamID } from '@ceramicnetwork/streamid' import { afterAll, beforeAll, describe, expect, test } from '@jest/globals' -import { newCeramic } from '../../utils/ceramicHelpers.js' -import * as helpers from '../../utils/dynamoDbHelpers.js' +import { newCeramic } from '../../../utils/ceramicHelpers.js' +import * as helpers from '../../../utils/dynamoDbHelpers.js' const ComposeDbUrls = String(process.env.COMPOSEDB_URLS).split(',') diff --git a/suite/src/__tests__/fast/model-correctness.test.ts b/suite/src/__tests__/correctness/fast/model-correctness.test.ts similarity index 89% rename from suite/src/__tests__/fast/model-correctness.test.ts rename to suite/src/__tests__/correctness/fast/model-correctness.test.ts index ce9aac3c..537c6e9c 100644 --- a/suite/src/__tests__/fast/model-correctness.test.ts +++ b/suite/src/__tests__/correctness/fast/model-correctness.test.ts @@ -1,13 +1,13 @@ import { describe, test, beforeAll, expect } from '@jest/globals' -import { loadDocumentOrTimeout, newCeramic } from '../../utils/ceramicHelpers.js' -import { createDid } from '../../utils/didHelper.js' +import { loadDocumentOrTimeout, newCeramic } from '../../../utils/ceramicHelpers.js' +import { createDid } from '../../../utils/didHelper.js' import { StreamID } from '@ceramicnetwork/streamid' import { Model } from '@ceramicnetwork/stream-model' import { ModelInstanceDocument } from '@ceramicnetwork/stream-model-instance' -import { LIST_MODEL_DEFINITION } from '../../models/modelConstants' +import { LIST_MODEL_DEFINITION } from '../../../models/modelConstants' import { CeramicClient } from '@ceramicnetwork/http-client' import { CommonTestUtils as TestUtils } from '@ceramicnetwork/common-test-utils' -import { indexModelOnNode } from '../../utils/composeDbHelpers.js' +import { indexModelOnNode } from '../../../utils/composeDbHelpers.js' const ComposeDbUrls = String(process.env.COMPOSEDB_URLS).split(',') const adminSeeds = String(process.env.COMPOSEDB_ADMIN_DID_SEEDS).split(',') diff --git a/suite/src/__tests__/fast/sync-events.test.ts b/suite/src/__tests__/correctness/fast/sync-events.test.ts similarity index 99% rename from suite/src/__tests__/fast/sync-events.test.ts rename to suite/src/__tests__/correctness/fast/sync-events.test.ts index c6235a6e..adef270d 100644 --- a/suite/src/__tests__/fast/sync-events.test.ts +++ b/suite/src/__tests__/correctness/fast/sync-events.test.ts @@ -1,8 +1,8 @@ import { beforeAll, describe, expect, test } from '@jest/globals' -import { utilities } from '../../utils/common.js' +import { utilities } from '../../../utils/common.js' import fetch from 'cross-fetch' import { randomCID, StreamID } from '@ceramicnetwork/streamid' -import { ReconEvent, ReconEventInput, randomEvents } from '../../utils/rustCeramicHelpers.js' +import { ReconEvent, ReconEventInput, randomEvents } from '../../../utils/rustCeramicHelpers.js' const delayMs = utilities.delayMs // Environment variables diff --git a/suite/src/__tests__/fast/update.test.ts b/suite/src/__tests__/correctness/fast/update.test.ts similarity index 94% rename from suite/src/__tests__/fast/update.test.ts rename to suite/src/__tests__/correctness/fast/update.test.ts index 92c007ac..5d56fb0f 100644 --- a/suite/src/__tests__/fast/update.test.ts +++ b/suite/src/__tests__/correctness/fast/update.test.ts @@ -2,12 +2,12 @@ import { StreamReaderWriter, SyncOptions } from '@ceramicnetwork/common' import { CeramicClient } from '@ceramicnetwork/http-client' import { afterAll, beforeAll, expect, test, describe } from '@jest/globals' -import * as helpers from '../../utils/dynamoDbHelpers.js' -import { loadDocumentOrTimeout, newCeramic, waitForCondition } from '../../utils/ceramicHelpers.js' -import { createDid } from '../../utils/didHelper.js' -import { LIST_MODEL_DEFINITION } from '../../models/modelConstants.js' +import * as helpers from '../../../utils/dynamoDbHelpers.js' +import { loadDocumentOrTimeout, newCeramic, waitForCondition } from '../../../utils/ceramicHelpers.js' +import { createDid } from '../../../utils/didHelper.js' +import { LIST_MODEL_DEFINITION } from '../../../models/modelConstants.js' import { Model } from '@ceramicnetwork/stream-model' -import { indexModelOnNode } from '../../utils/composeDbHelpers.js' +import { indexModelOnNode } from '../../../utils/composeDbHelpers.js' import { StreamID } from '@ceramicnetwork/streamid' import { ModelInstanceDocument } from '@ceramicnetwork/stream-model-instance' diff --git a/suite/src/__tests__/slow/ceramic-cas-integration.test.ts b/suite/src/__tests__/correctness/slow/ceramic-cas-integration.test.ts similarity index 95% rename from suite/src/__tests__/slow/ceramic-cas-integration.test.ts rename to suite/src/__tests__/correctness/slow/ceramic-cas-integration.test.ts index 82cc5678..ec53d437 100644 --- a/suite/src/__tests__/slow/ceramic-cas-integration.test.ts +++ b/suite/src/__tests__/correctness/slow/ceramic-cas-integration.test.ts @@ -1,10 +1,10 @@ import { AnchorStatus } from '@ceramicnetwork/common' import { describe, test, beforeAll, expect, jest } from '@jest/globals' -import { newCeramic, waitForAnchor } from '../../utils/ceramicHelpers.js' -import { createDid } from '../../utils/didHelper.js' +import { newCeramic, waitForAnchor } from '../../../utils/ceramicHelpers.js' +import { createDid } from '../../../utils/didHelper.js' import { Model } from '@ceramicnetwork/stream-model' -import { LIST_MODEL_DEFINITION } from '../../models/modelConstants.js' -import { indexModelOnNode } from '../../utils/composeDbHelpers.js' +import { LIST_MODEL_DEFINITION } from '../../../models/modelConstants.js' +import { indexModelOnNode } from '../../../utils/composeDbHelpers.js' import { CeramicClient } from '@ceramicnetwork/http-client' import { ModelInstanceDocument } from '@ceramicnetwork/stream-model-instance' import { StreamID } from '@ceramicnetwork/streamid' diff --git a/suite/src/__tests__/migration/all-event-types.tests.ts b/suite/src/__tests__/migration/all-event-types.tests.ts index 58dc98b6..b52fd514 100644 --- a/suite/src/__tests__/migration/all-event-types.tests.ts +++ b/suite/src/__tests__/migration/all-event-types.tests.ts @@ -198,8 +198,7 @@ describe('All Event Types', () => { let listModelId: StreamID let ceramicVersion: string - //See https://linear.app/3boxlabs/issue/AES-197/fix-flaky-migration-ceramic-test - test.skip('migrate', async () => { + test('migrate', async () => { // Setup client and models ceramicVersion = await getVersion(ceramicUrls[0]) const did = await createDid(adminSeeds[0])