File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -25,14 +25,12 @@ describe('backups', async () => {
25
25
const TABLE_ID = generateId ( ) ;
26
26
const BACKUP_ID = generateId ( ) ;
27
27
28
- const instance = await obtainTestInstance ( ) ;
29
-
30
- const INSTANCE_ID = instance . id ;
31
- const CLUSTER_ID = instance . id ; // The test function uses the same name.
32
-
33
- const table = instance . table ( TABLE_ID ) ;
34
- const cluster = instance . cluster ( INSTANCE_ID ) ;
35
- const backup = cluster . backup ( BACKUP_ID ) ;
28
+ let instance ;
29
+ let INSTANCE_ID ;
30
+ let CLUSTER_ID ;
31
+ let table ;
32
+ let cluster ;
33
+ let backup ;
36
34
37
35
async function createTestBackup ( backupId ) {
38
36
const [ backup , operation ] = await cluster . createBackup ( backupId , {
@@ -44,6 +42,15 @@ describe('backups', async () => {
44
42
}
45
43
46
44
before ( async ( ) => {
45
+ instance = await obtainTestInstance ( ) ;
46
+
47
+ INSTANCE_ID = instance . id ;
48
+ CLUSTER_ID = instance . id ; // The test function uses the same name.
49
+
50
+ table = instance . table ( TABLE_ID ) ;
51
+ cluster = instance . cluster ( INSTANCE_ID ) ;
52
+ backup = cluster . backup ( BACKUP_ID ) ;
53
+
47
54
await table . create ( ) ;
48
55
await table . createFamily ( 'follows' ) ;
49
56
await table . insert ( [
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ async function getStaleInstances() {
50
50
* the result.
51
51
*/
52
52
async function obtainTestInstance ( ) {
53
+ // Note: Do not use this function if it is only inside a describe block.
53
54
if ( ! obtainPromise ) {
54
55
obtainPromise = createTestInstance ( ) ;
55
56
}
You can’t perform that action at this time.
0 commit comments