Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

Commit 348210c

Browse files
authored
tests: clean up system tests with separate resources per test (#2122)
* tests: fix two system-test bugs with one scone * tests: modernize system tests with individual resources per test * chore: update the headers on duplicated files to please the bot * tests: remove thirty and sixty constants, shift to number of subs * tests: uncomment commented code for later use
1 parent 511739f commit 348210c

4 files changed

Lines changed: 717 additions & 563 deletions

File tree

samples/system-test/testResources.ts

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// I don't like that these two files (this plus ".test") are duplicated
16+
// across the two test structures, but because of the tangle of rootDirs
17+
// and package.json "files", it's hard to avoid it.
18+
1519
import * as uuid from 'uuid';
1620

1721
// Returns a shortened UUID that can be used to identify a
@@ -76,7 +80,7 @@ export class TestResources {
7680
getPrefix(testId?: string): string {
7781
if (testId) {
7882
return [this.testSuiteId, this.currentTime, normalizeId(testId)].join(
79-
'-'
83+
'-',
8084
);
8185
} else {
8286
return [this.testSuiteId, this.currentTime].join('-');
@@ -97,7 +101,7 @@ export class TestResources {
97101
*/
98102
generateBigQueryName(testId: string): string {
99103
return [normalizeId(this.getPrefix(testId)), this.tokenMaker.uuid()].join(
100-
'_'
104+
'_',
101105
);
102106
}
103107

@@ -107,45 +111,39 @@ export class TestResources {
107111
*/
108112
generateStorageName(testId: string): string {
109113
return [normalizeId(this.getPrefix(testId)), this.tokenMaker.uuid()].join(
110-
'_'
114+
'_',
111115
);
112116
}
113117

114-
/*!
118+
/**
115119
* Given a list of resource names (and a test ID), this will return
116120
* a list of all resources that should be deleted to clean up for
117121
* the current run of that particular test.
118-
*
119-
* Leaving this commented out for now since it's not actively needed.
120122
*/
121-
/*filterForTest(testId: string, allResources: Resource[]): Resource[] {
123+
filterForTest(testId: string, allResources: Resource[]): Resource[] {
122124
const prefix = this.getPrefix(testId);
123125
return allResources.filter(n => n.name?.includes(prefix));
124-
}*/
126+
}
125127

126-
/*!
128+
/**
127129
* Given a list of resource names, this will return a list of all
128130
* resources that should be deleted to clean up after the current
129131
* run of a test suite.
130-
*
131-
* Leaving this commented out for now since it's not actively needed.
132132
*/
133-
/*filterForCurrentRun(allResources: Resource[]): Resource[] {
133+
filterForCurrentRun(allResources: Resource[]): Resource[] {
134134
const prefix = this.getPrefix();
135135
return allResources.filter(n => n.name?.includes(prefix));
136-
}*/
136+
}
137137

138138
/**
139139
* Given a list of resource names, this will return a list of all
140140
* resources that should be deleted to clean up after any run
141141
* of the current test suite. Note that some of the names may
142142
* still be in use.
143-
*
144-
* Leaving this commented out for now since it's not actively needed.
145143
*/
146-
/*filterForSuite(allResources: Resource[]): Resource[] {
144+
filterForSuite(allResources: Resource[]): Resource[] {
147145
return allResources.filter(n => n.name?.includes(this.testSuiteId));
148-
}*/
146+
}
149147

150148
/**
151149
* Given a list of resource names, this will return a list of all

0 commit comments

Comments
 (0)