Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update workflows to only run the migration tests ... #154

Merged
merged 3 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/hermetic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
41 changes: 38 additions & 3 deletions .github/workflows/hermetic_long_lived.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-durable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/schedule-durable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ DURABLE_ENV ?= dev
DURABLE_TEST_BRANCH ?= main

# Test selector
TEST_SELECTOR ?= .
TEST_SELECTOR ?= correctness

PNPM = pnpm

Expand Down
2 changes: 1 addition & 1 deletion ci-scripts/schedule_durable_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
2 changes: 1 addition & 1 deletion suite/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Original file line number Diff line number Diff line change
Expand Up @@ -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(',')

Expand Down
Original file line number Diff line number Diff line change
@@ -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(',')
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(',')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(',')
Expand Down
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(',')

Expand Down
Original file line number Diff line number Diff line change
@@ -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(',')
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
3 changes: 1 addition & 2 deletions suite/src/__tests__/migration/all-event-types.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
Loading