diff --git a/.github/workflows/hermetic.yml b/.github/workflows/hermetic.yml index bb99efd..d555314 100644 --- a/.github/workflows/hermetic.yml +++ b/.github/workflows/hermetic.yml @@ -90,7 +90,7 @@ jobs: run-tests: name: Test runs-on: ubuntu-latest - environment: test + environment: dev needs: - generate-matrix - build-driver @@ -138,7 +138,7 @@ jobs: run-migration-tests: name: Test Migrations runs-on: ubuntu-latest - environment: test + environment: dev needs: - build-driver - publish-suite diff --git a/.github/workflows/hermetic_long_lived.yml b/.github/workflows/hermetic_long_lived.yml deleted file mode 100644 index 60526b0..0000000 --- a/.github/workflows/hermetic_long_lived.yml +++ /dev/null @@ -1,178 +0,0 @@ -name: Run long-lived Hermetic tests - -on: - schedule: - - cron: "0 0/8 * * *" # Every 8 hours - workflow_dispatch: # manually triggered - inputs: - test_selector: - type: string - description: Path regex passed to Jest to select which tests to run - required: true - default: correctness/fast - -env: - CARGO_TERM_COLOR: always - SCCACHE_GHA_ENABLED: "true" - RUSTC_WRAPPER: "sccache" - -jobs: - generate-matrix: - name: Generate Matrix - runs-on: ubuntu-latest - outputs: - networks: ${{ steps.generate-matrix.outputs.networks }} - build_tag: ${{ steps.generate-matrix.outputs.build_tag }} - steps: - - - name: Checkout - uses: actions/checkout@v3 - - - name: Generate network matrix - id: generate-matrix - run: | - NETWORKS=$(ls networks | jq -R -s -c '. | gsub(".yaml"; "") | split("\n")[:-1]') - echo "Networks:" - echo ${NETWORKS} - echo "networks=${NETWORKS}" >> $GITHUB_OUTPUT - # Choose unique name for this build - BUILD_TAG="$(echo ${{ github.sha }} | head -c 8)-${{ github.run_id }}" - echo "Build tag:" - echo ${BUILD_TAG} - echo "build_tag=${BUILD_TAG}" >> $GITHUB_OUTPUT - cat $GITHUB_OUTPUT - - publish-suite: - name: Publish Suite - runs-on: ubuntu-latest - needs: generate-matrix - steps: - - uses: actions/checkout@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to Public ECR - uses: docker/login-action@v2 - with: - registry: public.ecr.aws - username: ${{ secrets.AWS_ACCESS_KEY_ID }} - password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - env: - AWS_REGION: us-east-1 - - name: Build and Publish - run: make BUILD_TAG=${{ needs.generate-matrix.outputs.build_tag }} publish-suite - - build-driver: - name: Build 'hermetic-driver' binary - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - with: - # The prefix cache key, this can be changed to start a new cache manually. - # default: "v0-rust" - prefix-key: v0 - # Cache only the cargo registry - cache-targets: false - - uses: mozilla-actions/sccache-action@v0.0.3 - - name: Build Tester - run: make BUILD_PROFILE=release driver - - uses: actions/upload-artifact@master - with: - name: hermetic-driver - path: ./target/release/hermetic-driver - retention-days: 1 - - run-tests: - name: Test - runs-on: ubuntu-latest - environment: test - needs: - - generate-matrix - - build-driver - - publish-suite - strategy: - fail-fast: false - matrix: - networks: ${{ fromJSON(needs.generate-matrix.outputs.networks) }} - 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: | - export BUILD_TAG=${{ needs.generate-matrix.outputs.build_tag }} - export TEST_NETWORK=./networks/${{ matrix.networks }}.yaml - 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 || '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, run-migration-tests] - steps: - - run: exit 1 - # see https://stackoverflow.com/a/67532120/4907315 - if: >- - ${{ - contains(needs.*.result, 'failure') - || contains(needs.*.result, 'cancelled') - }} diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index ccdbde8..3c33a3f 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -61,7 +61,7 @@ jobs: run-performance-tests: name: Performance Tests runs-on: ubuntu-latest - environment: github-tests-2024 + environment: dev needs: - generate-matrix - build-driver diff --git a/.github/workflows/run-performance.yaml b/.github/workflows/run-performance.yaml index 43b131c..99d304d 100644 --- a/.github/workflows/run-performance.yaml +++ b/.github/workflows/run-performance.yaml @@ -27,7 +27,7 @@ jobs: run-performance-test: name: Run Performance Test ${{ github.run_id }} runs-on: ubuntu-latest - environment: cas-scaling-2024 + environment: dev steps: - name: Checkout uses: actions/checkout@v3 diff --git a/suite/src/__tests__/correctness/fast/longevity.test.ts b/suite/src/__tests__/correctness/fast/longevity.test.ts deleted file mode 100644 index 488815b..0000000 --- a/suite/src/__tests__/correctness/fast/longevity.test.ts +++ /dev/null @@ -1,79 +0,0 @@ -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' - -const ComposeDbUrls = String(process.env.COMPOSEDB_URLS).split(',') - -/** - * Longevity test tests that streams that were created (and pinned) in the past continue to be - * accessible days later, possibly even after a new version of Ceramic is released and deployed. - */ -describe('longevity', () => { - // `step` is incremented once for each r/w node during the `update` test, so use - // the length of the r/w URL array to test the content. - const expectedContent = { step: ComposeDbUrls.length } - let streamIds: Array = [] - - beforeAll(async () => { - await helpers.createTestTable() - const anchoredReqs = await helpers.fetchAnchoredStreamReqs() - console.log(`Found ${anchoredReqs.length} already anchored streams in the database to load`) - streamIds = anchoredReqs.map((req) => { - return StreamID.fromString(req.StreamId.S) - }) - }) - - afterAll(async () => await helpers.cleanup()) - - for (const apiUrl of ComposeDbUrls) { - test(`load streams on ${apiUrl}`, async () => { - const ceramic = await newCeramic(apiUrl) - for (const streamId of streamIds) { - console.log(`Loading stream ${streamId} on ${apiUrl}`) - const doc = await ceramic.loadStream(streamId) - try { - expect(doc.content).toEqual(expectedContent) - expect(doc.state.anchorStatus).toEqual(AnchorStatus.ANCHORED) - - // Now load the same stream but at a specific CommitID. Loading at a CommitID - // means the Ceramic node can't get the state from the state store, but has - // to actually load and apply the commits from IPFS, so it lets us check that the - // underlying ipfs blocks are still available. - const commitIds = doc.allCommitIds - const prevCommitId = commitIds[commitIds.length - 2] - console.log( - `Loading commit ${prevCommitId} on ${apiUrl} for stream state:\n${JSON.stringify( - StreamUtils.serializeState(doc.state), - null, - 2, - )}`, - ) - const docAtPrevCommitId = await ceramic.loadStream(prevCommitId) - - // The last commit is an anchor commit, so the second to last commit will actually - // have the same content as the current state with the most recent commit, it just - // won't have the anchor information. - expect(docAtPrevCommitId.content).toEqual(expectedContent) - expect(docAtPrevCommitId.state.anchorStatus).not.toEqual(AnchorStatus.ANCHORED) - } catch (err) { - console.error( - `Test failed. StreamID: ${doc.id.toString()}, state:\n${JSON.stringify( - StreamUtils.serializeState(doc.state), - null, - 2, - )}`, - ) - - // If the test failed, we don't want to leave this stream in the database, - // as it will cause all future test executions to fail as well. - await helpers.deleteStreamReq(doc.id) - - throw err - } - } - }) - } -})