test(dev-infra): publish test should not rely on external http request (#41767)
A test for the dev-infra publish tool currently relies on an external http request by accident. This will break if we disallow internet access within RBE containers. PR Close #41767
This commit is contained in:
parent
59bb24148e
commit
1b00533f8b
|
@ -19,7 +19,7 @@ import {ReleaseAction} from '../actions';
|
||||||
import {actions} from '../actions/index';
|
import {actions} from '../actions/index';
|
||||||
import {changelogPath} from '../constants';
|
import {changelogPath} from '../constants';
|
||||||
|
|
||||||
import {getChangelogForVersion, getTestingMocksForReleaseAction, parse, setupReleaseActionForTesting, testTmpDir} from './test-utils';
|
import {fakeNpmPackageQueryRequest, getChangelogForVersion, getTestingMocksForReleaseAction, parse, setupReleaseActionForTesting, testTmpDir} from './test-utils';
|
||||||
|
|
||||||
describe('common release action logic', () => {
|
describe('common release action logic', () => {
|
||||||
const baseReleaseTrains: ActiveReleaseTrains = {
|
const baseReleaseTrains: ActiveReleaseTrains = {
|
||||||
|
@ -36,16 +36,12 @@ describe('common release action logic', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
it('should not modify release train versions and cause invalid other actions', async () => {
|
it('should not modify release train versions and cause invalid other actions', async () => {
|
||||||
// The cached npm package information needs to be deleted as depending on the test order
|
|
||||||
// their may or may not be packages in the cache, causing the number of active LTS branches
|
|
||||||
// in this test to be 2 instead of 0.
|
|
||||||
for (const packageName in _npmPackageInfoCache) {
|
|
||||||
delete _npmPackageInfoCache[packageName];
|
|
||||||
}
|
|
||||||
|
|
||||||
const {releaseConfig, gitClient} = getTestingMocksForReleaseAction();
|
const {releaseConfig, gitClient} = getTestingMocksForReleaseAction();
|
||||||
const descriptions: string[] = [];
|
const descriptions: string[] = [];
|
||||||
|
|
||||||
|
// Fake the NPM package request as otherwise the test would rely on `npmjs.org`.
|
||||||
|
fakeNpmPackageQueryRequest(releaseConfig.npmPackages[0], {'dist-tags': {}});
|
||||||
|
|
||||||
for (const actionCtor of actions) {
|
for (const actionCtor of actions) {
|
||||||
if (await actionCtor.isActive(testReleaseTrain)) {
|
if (await actionCtor.isActive(testReleaseTrain)) {
|
||||||
const action = new actionCtor(testReleaseTrain, gitClient, releaseConfig, testTmpDir);
|
const action = new actionCtor(testReleaseTrain, gitClient, releaseConfig, testTmpDir);
|
||||||
|
|
Loading…
Reference in New Issue