Skip to content

Commit

Permalink
Rename oldBundle to oldConfig (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
ejizba authored Jan 30, 2024
1 parent e922a76 commit 1f17f4f
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 39 deletions.
File renamed without changes.
File renamed without changes.
36 changes: 18 additions & 18 deletions azure-pipelines/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,27 +102,27 @@ jobs:
- script: npm run createCombinedApps
displayName: 'Create combined apps'

# Setup v3 oldBundle app
# Setup v3 oldConfig app
- script: npm ci
displayName: 'install deps v3 app (oldBundle)'
workingDirectory: 'app/combined/v3-oldBundle'
displayName: 'install deps v3 app (oldConfig)'
workingDirectory: 'app/combined/v3-oldConfig'
- script: npm install "$(Pipeline.Workspace)/nodeLibraryV3/drop/package.tgz"
displayName: 'install latest v3 library (oldBundle)'
workingDirectory: 'app/combined/v3-oldBundle'
displayName: 'install latest v3 library (oldConfig)'
workingDirectory: 'app/combined/v3-oldConfig'
- script: npm run build
displayName: 'build v3 app (oldBundle)'
workingDirectory: 'app/combined/v3-oldBundle'
displayName: 'build v3 app (oldConfig)'
workingDirectory: 'app/combined/v3-oldConfig'

# Setup v4 oldBundle app
# Setup v4 oldConfig app
- script: npm ci
displayName: 'install deps v4 app (oldBundle)'
workingDirectory: 'app/combined/v4-oldBundle'
displayName: 'install deps v4 app (oldConfig)'
workingDirectory: 'app/combined/v4-oldConfig'
- script: npm install "$(Pipeline.Workspace)/nodeLibraryV4/drop/package.tgz"
displayName: 'install latest v4 library (oldBundle)'
workingDirectory: 'app/combined/v4-oldBundle'
displayName: 'install latest v4 library (oldConfig)'
workingDirectory: 'app/combined/v4-oldConfig'
- script: npm run build
displayName: 'build v4 app (oldBundle)'
workingDirectory: 'app/combined/v4-oldBundle'
displayName: 'build v4 app (oldConfig)'
workingDirectory: 'app/combined/v4-oldConfig'

# Run tests Node 16
- task: NodeTool@0
Expand Down Expand Up @@ -154,9 +154,9 @@ jobs:
AZURE_CLIENT_SECRET: $(AZURE_CLIENT_SECRET)
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)

# Run tests for old bundle (just one Node.js version is enough)
- script: npm run testOldBundle
displayName: 'Run tests old bundle'
# Run tests for old config (just one Node.js version is enough)
- script: npm run testOldConfig
displayName: 'Run tests old config'
continueOnError: true
env:
AZURE_TENANT_ID: $(AZURE_TENANT_ID)
Expand Down Expand Up @@ -193,4 +193,4 @@ jobs:
inputs:
testResultsFiles: 'e2e-test-results/*.xml'
failTaskOnFailedTests: true
condition: succeededOrFailed()
condition: succeededOrFailed()
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
"createCombinedApps": "node out/createCombinedApps.js",
"deleteResources": "node out/resources/deleteResources.js",
"test": "npm run testV3 && npm run testV4",
"testOldBundle": "npm run testV3OldBundle && npm run testV4OldBundle",
"testOldConfig": "npm run testV3OldConfig && npm run testV4OldConfig",
"testV3": "node out/index.js --model v3",
"testV3OldBundle": "node out/index.js --model v3 --oldBundle",
"testV3OldConfig": "node out/index.js --model v3 --oldConfig",
"testV4": "node out/index.js --model v4",
"testV4OldBundle": "node out/index.js --model v4 --oldBundle"
"testV4OldConfig": "node out/index.js --model v4 --oldConfig"
},
"dependencies": {
"@azure/arm-cosmosdb": "^15.4.0",
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export namespace EnvVarNames {
export const defaultTimeout = 3 * 60 * 1000;

export const combinedFolder = 'combined';
export const oldBundleSuffix = '-oldBundle';
export const oldConfigSuffix = '-oldConfig';

export function getFuncUrl(routeSuffix: string): string {
return `http://127.0.0.1:7071/api/${routeSuffix}`;
Expand Down
8 changes: 4 additions & 4 deletions src/createCombinedApps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@

import fs from 'fs/promises';
import path from 'path';
import { combinedFolder, oldBundleSuffix } from './constants';
import { combinedFolder, oldConfigSuffix } from './constants';

async function createCombinedApps(): Promise<void> {
const appRoot = path.join(__dirname, '..', 'app');
for (const model of ['v3', 'v4']) {
const modelRoot = path.join(appRoot, model);
const oldBundleRoot = path.join(appRoot, model + oldBundleSuffix);
const combinedRoot = path.join(appRoot, combinedFolder, model + oldBundleSuffix);
const oldConfigRoot = path.join(appRoot, model + oldConfigSuffix);
const combinedRoot = path.join(appRoot, combinedFolder, model + oldConfigSuffix);
await fs.cp(modelRoot, combinedRoot, {
recursive: true,
filter: (source) => {
const foldersToExclude = ['dist', 'node_modules'];
return !foldersToExclude.find((f) => source.includes(f));
},
});
await fs.cp(oldBundleRoot, combinedRoot, { recursive: true });
await fs.cp(oldConfigRoot, combinedRoot, { recursive: true });
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/getModelArg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export function getModelArg(): Model {
}
}

export function getOldBundleArg(): boolean {
const flag = 'oldBundle';
export function getOldConfigArg(): boolean {
const flag = 'oldConfig';
const args = parseArgs(process.argv.slice(2), { boolean: flag });
return args[flag];
}
12 changes: 6 additions & 6 deletions src/global.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import cp from 'child_process';
import * as fs from 'fs/promises';
import path from 'path';
import semver from 'semver';
import { combinedFolder, defaultTimeout, EnvVarNames, oldBundleSuffix } from './constants';
import { getModelArg, getOldBundleArg, Model } from './getModelArg';
import { combinedFolder, defaultTimeout, EnvVarNames, oldConfigSuffix } from './constants';
import { getModelArg, getOldConfigArg, Model } from './getModelArg';
import {
cosmosDBConnectionString,
eventHubConnectionString,
Expand All @@ -21,7 +21,7 @@ import findProcess = require('find-process');
let perTestFuncOutput = '';
let fullFuncOutput = '';
export let model: Model | undefined;
export let isOldBundle: boolean;
export let isOldConfig: boolean;
let childProc: cp.ChildProcess | undefined;
let testsDone = false;

Expand All @@ -35,9 +35,9 @@ before(async function (this: Mocha.Context): Promise<void> {

await initializeConnectionStrings();

isOldBundle = getOldBundleArg();
const appPath = isOldBundle
? path.join(__dirname, '..', 'app', combinedFolder, model + oldBundleSuffix)
isOldConfig = getOldConfigArg();
const appPath = isOldConfig
? path.join(__dirname, '..', 'app', combinedFolder, model + oldConfigSuffix)
: path.join(__dirname, '..', 'app', model);

await startFuncProcess(appPath);
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import globby from 'globby';
import Mocha from 'mocha';
import path from 'path';
import { defaultTimeout } from './constants';
import { getModelArg, getOldBundleArg } from './getModelArg';
import { getModelArg, getOldConfigArg } from './getModelArg';

export async function run(): Promise<void> {
try {
const bundleSuffix = getOldBundleArg() ? '_oldBundle' : '';
const fileName = `${process.platform}_model-${getModelArg()}_Node-${process.version}${bundleSuffix}.xml`;
const oldConfigSuffix = getOldConfigArg() ? '_oldConfig' : '';
const fileName = `${process.platform}_model-${getModelArg()}_Node-${process.version}${oldConfigSuffix}.xml`;
const options: Mocha.MochaOptions = {
color: true,
timeout: defaultTimeout,
Expand Down
4 changes: 2 additions & 2 deletions src/sql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { expect } from 'chai';
import { default as fetch } from 'node-fetch';
import { v4 as uuid } from 'uuid';
import { getFuncUrl } from './constants';
import { isOldBundle, waitForOutput } from './global.test';
import { isOldConfig, waitForOutput } from './global.test';
import { getRandomTestData } from './utils/getRandomTestData';

describe('sql', () => {
before(function (this: Mocha.Context) {
if (isOldBundle) {
if (isOldConfig) {
this.skip();
}
});
Expand Down

0 comments on commit 1f17f4f

Please sign in to comment.