Skip to content

Commit

Permalink
Update pr script (#214)
Browse files Browse the repository at this point in the history
* Updated pr script to prompt for coverage/acceptance tests

* Added no-tabs eslint rule and fix errors

* Updated the pewpew acceptance and integration to match fixes in scripting
  • Loading branch information
tkmcmaster authored Mar 29, 2024
1 parent c194ced commit 776e162
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 24 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"no-angle-bracket-type-assertion": 0,
"no-bitwise": 1,
"no-console": 1,
"no-tabs": 1,
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 0, "maxBOF": 0 }],
"no-empty": [1, { "allowEmptyCatch": true }],
"no-empty-interface": 0,
Expand Down
2 changes: 1 addition & 1 deletion controller/acceptance/healthcheck.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { expect } from "chai";

const fetch = _axios.get;

// Beanstalk <SYSTEM_NAME>_<SERVICE_NAME>_URL
// Beanstalk <SYSTEM_NAME>_<SERVICE_NAME>_URL
const integrationUrl = "http://" + (process.env.BUILD_APP_URL || `localhost:${process.env.PORT || "8081"}`);

describe("Healthcheck Integration", () => {
Expand Down
20 changes: 16 additions & 4 deletions controller/acceptance/pewpew.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function fetch (
const UNIT_TEST_FOLDER = process.env.UNIT_TEST_FOLDER || "test";
const PEWPEW_ZIP_FILEPATH = process.env.PEWPEW_ZIP_FILEPATH || path.join(UNIT_TEST_FOLDER, PEWPEW_BINARY_EXECUTABLE + ".zip");

// Beanstalk <SYSTEM_NAME>_<SERVICE_NAME>_URL
// Beanstalk <SYSTEM_NAME>_<SERVICE_NAME>_URL
const integrationUrl = "http://" + (process.env.BUILD_APP_URL || `localhost:${process.env.PORT || "8081"}`);

let sharedPewPewVersions: string[] | undefined;
Expand Down Expand Up @@ -208,8 +208,7 @@ describe("PewPew API Integration", () => {
});

describe("DELETE /pewpew", () => {
after(async () => {
// Put the version back
const uploadPewpew = async () => {
try {
const filename: string = path.basename(PEWPEW_ZIP_FILEPATH);
const formData: FormDataPewPew = {
Expand Down Expand Up @@ -252,17 +251,30 @@ describe("PewPew API Integration", () => {
} catch (error) {
throw error;
}
};

beforeEach(async () => {
if (uploadedPewPewVersion) {
return;
}
await uploadPewpew();
});

after(async () => {
// Put the version back
await uploadPewpew();
});

it("DELETE /pewpew should respond 200 OK", (done: Mocha.Done) => {
expect(uploadedPewPewVersion).to.not.equal(undefined);
const deleteVersion = uploadedPewPewVersion;
const deleteURL = `${url}?version=${deleteVersion}`;
log("DELETE URL", LogLevel.DEBUG, { deleteURL });
// Reset it since it's been deleted
uploadedPewPewVersion = undefined;
fetch(deleteURL, { method: "DELETE" }).then((res: Response) => {
log("DELETE /pewpew res", LogLevel.DEBUG, res);
expect(res.status).to.equal(200);
uploadedPewPewVersion = undefined;
const body: TestManagerError = res.data;
log("body: " + res.data, LogLevel.DEBUG, body);
expect(body).to.not.equal(undefined);
Expand Down
2 changes: 1 addition & 1 deletion controller/acceptance/queues.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { expect } from "chai";

const fetch = _axios.get;

// Beanstalk <SYSTEM_NAME>_<SERVICE_NAME>_URL
// Beanstalk <SYSTEM_NAME>_<SERVICE_NAME>_URL
const integrationUrl = "http://" + (process.env.BUILD_APP_URL || `localhost:${process.env.PORT || "8081"}`);

let sharedQueueNames: string[] | undefined;
Expand Down
2 changes: 1 addition & 1 deletion controller/acceptance/test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const defaultEnvironmentVariables: EnvironmentVariablesFile = {
TEST2: "true"
};

// Beanstalk <SYSTEM_NAME>_<SERVICE_NAME>_URL
// Beanstalk <SYSTEM_NAME>_<SERVICE_NAME>_URL
export const integrationUrl = "http://" + (process.env.BUILD_APP_URL || `localhost:${process.env.PORT || "8081"}`);

let sharedPpaasTestId: PpaasTestId | undefined;
Expand Down
4 changes: 2 additions & 2 deletions controller/components/YamlWriterUpload/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export const YamlWriterUpload = (props: YamlWriterUploadProps) => {
if (types[mimeType] !== undefined) {
types[mimeType]!.index.push({ iter: i, id });
} else {
types[mimeType] = { index: [{ iter: i, id }], selected: "partial"};
types[mimeType] = { index: [{ iter: i, id }], selected: "partial"};
}

// Adds a reference to an endpoint with given response type
Expand All @@ -292,7 +292,7 @@ export const YamlWriterUpload = (props: YamlWriterUploadProps) => {
} else {
urls[hostUrl] = { index: [{ iter: i, id }], selected: "yes"};
}
endpoints.push({ selected: "yes", url, type: mimeType, id, method: entry.request.method, headers: [...entry.request.headers] });
endpoints.push({ selected: "yes", url, type: mimeType, id, method: entry.request.method, headers: [...entry.request.headers] });
}

const typesTemp = types;
Expand Down
16 changes: 12 additions & 4 deletions controller/integration/pewpew.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,7 @@ describe("PewPew Util Integration", () => {
});

describe("deletePewPew", () => {
beforeEach(async () => {
if (uploadedPewPewVersion) {
return;
}
const uploadPewpew = async () => {
try {
const parsedForm: ParsedForm = {
fields: {},
Expand Down Expand Up @@ -317,6 +314,17 @@ describe("PewPew Util Integration", () => {
log("deletePewPew beforeEach error", LogLevel.ERROR, error);
throw error;
}
};

beforeEach(async () => {
if (uploadedPewPewVersion) {
return;
}
await uploadPewpew();
});

after(async () => {
await uploadPewpew();
});

it("deletePewPew should respond 200 OK", (done: Mocha.Done) => {
Expand Down
1 change: 1 addition & 0 deletions guide/results-viewer-react/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"no-angle-bracket-type-assertion": 0,
"no-bitwise": 1,
"no-console": 1,
"no-tabs": 1,
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 0, "maxBOF": 0 }],
"no-empty": [1, { "allowEmptyCatch": true }],
"no-empty-interface": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export const YamlWriterUpload = (props: YamlWriterUploadProps) => {
if (types[mimeType] !== undefined) {
types[mimeType]!.index.push({ iter: i, id });
} else {
types[mimeType] = { index: [{ iter: i, id }], selected: "partial"};
types[mimeType] = { index: [{ iter: i, id }], selected: "partial"};
}

// Adds a reference to an endpoint with given response type
Expand All @@ -291,7 +291,7 @@ export const YamlWriterUpload = (props: YamlWriterUploadProps) => {
} else {
urls[hostUrl] = { index: [{ iter: i, id }], selected: "yes"};
}
endpoints.push({ selected: "yes", url, type: mimeType, id, method: entry.request.method, headers: [...entry.request.headers] });
endpoints.push({ selected: "yes", url, type: mimeType, id, method: entry.request.method, headers: [...entry.request.headers] });
}

const typesTemp = types;
Expand Down
36 changes: 27 additions & 9 deletions pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ cargo clippy --all -- -D warnings
cargo test --all
cargo test --all --doc

cargo deny check --hide-inclusion-graph license sources advisories

CWD=$(pwd)

cd "$CWD/lib/config-wasm"
Expand Down Expand Up @@ -49,13 +51,29 @@ npm run build:common
npm run build:react
NODE_ENV=test npm test

# npm run testcleanup
# npm run coverage
# echo grab screenshot
read -e -p "Run Coverage Tests y/N: " choice
if [[ "$choice" == [Yy]* ]]; then
npm run testcleanup
# npm run coverage
# read -e -p "Grab screenshot then hit enter to continue." choice
npm run coverage:common
read -e -p "Grab common screenshot then hit enter to continue." choice
npm run coverage:controller
read -e -p "Grab controller screenshot then hit enter to continue." choice
npm run coverage:agent
read -e -p "Grab agent screenshot then hit enter to continue." choice
npm run testmerge
read -e -p "Grab overall screenshot then hit enter to continue." choice
fi

# npm run testcleanup
# echo Hit Ctrl-C when acceptance tests finish
# npm acceptance:all
# echo grab screenshot

cargo deny check --hide-inclusion-graph license sources advisories
read -e -p "Run Acceptance Tests y/N: " choice
if [[ "$choice" == [Yy]* ]]; then
while [[ "$clean_result" != "0" ]]; do
(npm run testcleanup)
clean_result=$?
echo "clean_result: $clean_result"
done
echo Hit Ctrl-C when acceptance tests finish
npm run acceptance:all
read -e -p "Grab screenshot then hit enter to continue." choice
fi

0 comments on commit 776e162

Please sign in to comment.