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

chore: update sporadically failing tests, upgrade tigerbeetle #1541

Merged
merged 4 commits into from
Jul 4, 2023
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
4 changes: 2 additions & 2 deletions infrastructure/helm/tigerbeetle/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ statefulset:
clusterId: "0"

image:
repository: ghcr.io/tigerbeetledb/tigerbeetle@sha256
repository: ghcr.io/tigerbeetledb/tigerbeetle
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "3e2954cba78e17db42013e56fd9850a6047f7caa6f30dd7c46ff932c809af10c"
tag: "0.13.38"

proxyImage:
repository: nginx
Expand Down
3 changes: 2 additions & 1 deletion jest.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ module.exports = {
},
testEnvironment: 'node',
moduleDirectories: ['node_modules', './'],
modulePaths: ['node_modules', './']
modulePaths: ['node_modules', './'],
workerThreads: true
Copy link
Contributor Author

@mkurapov mkurapov Jul 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
2 changes: 1 addition & 1 deletion localenv/tigerbeetle/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ services:
tigerbeetle:
env_file:
- ../tigerbeetle/.env.tigerbeetle
image: ghcr.io/tigerbeetledb/tigerbeetle@sha256:3e2954cba78e17db42013e56fd9850a6047f7caa6f30dd7c46ff932c809af10c
image: ghcr.io/tigerbeetle/tigerbeetle:0.13.38
privileged: true
volumes:
- tigerbeetle-data:/var/lib/tigerbeetle
Expand Down
20 changes: 14 additions & 6 deletions packages/auth/src/grant/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,23 @@ describe('Grant Service', (): void => {
})

describe('getGrantsPage', (): void => {
let grants: Grant[] | undefined
let grants: Grant[] = []
const paymentPointer = 'example.com/test'

beforeEach(async () => {
grants = await Promise.all(
[paymentPointer, paymentPointer, 'example.com/test3'].map(
async (identifier) => createGrant(deps, identifier)
)
)
for (const identifier of [
paymentPointer,
paymentPointer,
'example.com/test3'
]) {
grants.push(await createGrant(deps, { identifier }))
}
})

afterEach(async () => {
grants = []
})

test('No filter gets all', async (): Promise<void> => {
const grants = await grantService.getPage()
const allGrants = await Grant.query()
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/graphql/resolvers/grant.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('Grant Resolvers', (): void => {
const grants: GrantModel[] = []
const identifier = 'https://example.com/test'
for (let i = 0; i < 2; i++) {
const grant = await createGrant(deps, identifier)
const grant = await createGrant(deps, { identifier })
grants.push(grant)
}

Expand Down
5 changes: 2 additions & 3 deletions packages/auth/src/tests/grant.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { faker } from '@faker-js/faker'
import { v4 as uuid } from 'uuid'
import { FinishMethod, Grant, StartMethod } from '../grant/model'
import { generateNonce } from '../shared/utils'
import { AccessAction, AccessType } from '@interledger/open-payments'
Expand All @@ -8,13 +7,13 @@ import { AppServices } from '../app'

export async function createGrant(
deps: IocContract<AppServices>,
identifier?: string
options?: { identifier?: string }
): Promise<Grant> {
const grantService = await deps.use('grantService')
const CLIENT = faker.internet.url({ appendSlash: false })
const BASE_GRANT_ACCESS = {
actions: [AccessAction.Create, AccessAction.Read, AccessAction.List],
identifier: identifier ?? `https://example.com/${uuid()}`
identifier: options?.identifier
}

const BASE_GRANT_REQUEST = {
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"pino": "^8.14.1",
"pino-pretty": "^10.0.0",
"raw-body": "^2.5.2",
"tigerbeetle-node": "^0.12.76",
"tigerbeetle-node": "^0.13.38",
"token-introspection": "workspace:../token-introspection",
"uuid": "^9.0.0"
}
Expand Down
9 changes: 3 additions & 6 deletions packages/backend/src/tests/tigerbeetle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ export async function startTigerbeetleContainer(clusterId?: number): Promise<{
const tigerbeetleClusterId = clusterId || Config.tigerbeetleClusterId
const { name: tigerbeetleDir } = tmp.dirSync({ unsafeCleanup: true })
const tigerbeetleFile = `cluster_${tigerbeetleClusterId}_replica_0_test.tigerbeetle`
const tigerbeetleContainerVersion = 'ghcr.io/tigerbeetle/tigerbeetle:0.13.38'

const tbContFormat = await new GenericContainer(
'ghcr.io/tigerbeetledb/tigerbeetle@sha256:3e2954cba78e17db42013e56fd9850a6047f7caa6f30dd7c46ff932c809af10c'
)
const tbContFormat = await new GenericContainer(tigerbeetleContainerVersion)
.withExposedPorts(TIGERBEETLE_PORT)
.withBindMounts([
{
Expand Down Expand Up @@ -49,9 +48,7 @@ export async function startTigerbeetleContainer(clusterId?: number): Promise<{
.on('end', () => console.log('Stream closed for [tb-format]'))
}

const tbContStart = await new GenericContainer(
'ghcr.io/tigerbeetledb/tigerbeetle@sha256:3e2954cba78e17db42013e56fd9850a6047f7caa6f30dd7c46ff932c809af10c'
)
const tbContStart = await new GenericContainer(tigerbeetleContainerVersion)
.withExposedPorts(TIGERBEETLE_PORT)
.withBindMounts([
{
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

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