Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Commit

Permalink
fix: use new s3 instance for every test (#124)
Browse files Browse the repository at this point in the history
Fix race condition in tests where repo keys hang around.
  • Loading branch information
achingbrain committed Jul 30, 2021
1 parent 76686e6 commit d3c0056
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
13 changes: 7 additions & 6 deletions test/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ const { ShardingDatastore, shard: { NextToLast } } = require('datastore-core')
const BlockstoreDatastoreAdapter = require('blockstore-datastore-adapter')
const mockS3 = require('./fixtures/mock-s3')
const S3 = require('aws-sdk').S3
const s3Instance = new S3({
params: {
Bucket: 'test'
}
})
mockS3(s3Instance)
const { createRepo } = require('./fixtures/repo')

/**
Expand Down Expand Up @@ -75,6 +69,13 @@ const CONFIGURATIONS = [{
name: 'with s3',
cleanup: () => {},
createBackends: (prefix) => {
const s3Instance = new S3({
params: {
Bucket: 'test'
}
})
mockS3(s3Instance)

return {
root: new DatastoreS3(prefix, {
s3: s3Instance,
Expand Down
13 changes: 7 additions & 6 deletions test/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ const { ShardingDatastore, shard: { NextToLast } } = require('datastore-core')
const BlockstoreDatastoreAdapter = require('blockstore-datastore-adapter')
const mockS3 = require('./fixtures/mock-s3')
const S3 = require('aws-sdk').S3
const s3Instance = new S3({
params: {
Bucket: 'test'
}
})
mockS3(s3Instance)
const { createRepo } = require('./fixtures/repo')

function cleanup (dir) {
Expand Down Expand Up @@ -64,6 +58,13 @@ const CONFIGURATIONS = [{
name: 'with s3',
cleanup: () => {},
createBackends: (prefix) => {
const s3Instance = new S3({
params: {
Bucket: 'test'
}
})
mockS3(s3Instance)

return {
root: new DatastoreS3(prefix, {
s3: s3Instance,
Expand Down

0 comments on commit d3c0056

Please sign in to comment.