Skip to content

Commit

Permalink
tests(fetch-engine): check that all binaries git hashes are the same
Browse files Browse the repository at this point in the history
Closes #3415
  • Loading branch information
Jolg42 committed Aug 24, 2020
1 parent 7b4df2c commit d117060
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/packages/fetch-engine/src/__tests__/download.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const FIXED_BINARIES_HASH = '6c777331554df4c3e0a90dd841339c7b0619d0e1'
jest.setTimeout(30000)

describe('download', () => {
beforeAll(async () => {
beforeEach(async () => {
// completely clean up the cache and keep nothing
await cleanupCache(0)
await del(__dirname + '/**/*engine*')
Expand Down Expand Up @@ -68,6 +68,24 @@ describe('download', () => {
})

test('basic download all current binaries', async () => {
const platform = await getPlatform()
const queryEnginePath = path.join(
__dirname,
getBinaryName('query-engine', platform),
)
const introspectionEnginePath = path.join(
__dirname,
getBinaryName('introspection-engine', platform),
)
const migrationEnginePath = path.join(
__dirname,
getBinaryName('migration-engine', platform),
)
const prismafmtPath = path.join(
__dirname,
getBinaryName('prisma-fmt', platform),
)

await download({
binaries: {
'query-engine': __dirname,
Expand All @@ -87,6 +105,16 @@ describe('download', () => {
],
version: CURRENT_BINARIES_HASH,
})

// Check that all binaries git hash are the same
expect(await getVersion(queryEnginePath)).toContain(CURRENT_BINARIES_HASH)
expect(await getVersion(introspectionEnginePath)).toContain(
CURRENT_BINARIES_HASH,
)
expect(await getVersion(migrationEnginePath)).toContain(
CURRENT_BINARIES_HASH,
)
expect(await getVersion(prismafmtPath)).toContain(CURRENT_BINARIES_HASH)
})

test('auto heal corrupt binary', async () => {
Expand Down

0 comments on commit d117060

Please sign in to comment.