Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test mac and windows executables #209

Merged
merged 15 commits into from
Mar 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed issue with integration tests
- POST /pewpew tests need to run before the GET tests to make sure the data is there
- After the deletes are completed we need to put back any versions we deleted
  • Loading branch information
tkmcmaster committed Mar 25, 2024
commit dad0b6c2e9fd4daeba94269507a826e453d98905
73 changes: 54 additions & 19 deletions controller/integration/pewpew.spec.ts
Original file line number Diff line number Diff line change
@@ -74,25 +74,39 @@ describe("PewPew Util Integration", () => {
await waitForSecrets();
});

describe("getPewPewVersionsInS3", () => {
it("getPewPewVersionsInS3() should return array with elements", (done: Mocha.Done) => {
getPewPewVersionsInS3().then((result: string[]) => {
log("getPewPewVersionsInS3()", LogLevel.DEBUG, result);
expect(result).to.not.equal(undefined);
expect(Array.isArray(result), JSON.stringify(result)).to.equal(true);
expect(result.length).to.be.greaterThan(0);
for (const version of result) {
if (version !== latestPewPewVersion) {
log(`semver.valid(${version}) = ${semver.valid(version)}`, LogLevel.DEBUG);
expect(semver.valid(version), `semver.valid(${version})`).to.not.equal(null);
}
}
if (!sharedPewPewVersions) {
sharedPewPewVersions = result;
}
done();
}).catch((error) => done(error));
});
after(async () => {
try {
const parsedForm: ParsedForm = {
fields: {},
files
};
log("postPewPew parsedForm", LogLevel.DEBUG, parsedForm);
const res: ErrorResponse = await postPewPew(parsedForm, authAdmin);
log("postPewPew res", LogLevel.DEBUG, res);
expect(res.status, JSON.stringify(res.json)).to.equal(200);
const body: TestManagerError = res.json;
log("body: " + JSON.stringify(body), LogLevel.DEBUG, body);
expect(body).to.not.equal(undefined);
expect(body.message).to.not.equal(undefined);
expect(body.message).to.include("PewPew uploaded, version");
expect(body.message).to.not.include("as latest");
const match: RegExpMatchArray | null = body.message.match(/PewPew uploaded, version: (\d+\.\d+\.\d+)/);
log(`pewpew match: ${match}`, LogLevel.DEBUG, match);
expect(match, "pewpew match").to.not.equal(null);
expect(match!.length, "pewpew match.length").to.be.greaterThan(1);
const version: string = match![1];
uploadedPewPewVersion = version;
log("uploadedPewPewVersion: " + uploadedPewPewVersion, LogLevel.DEBUG);
const s3Versions: string[] = await getPewPewVersionsInS3();
expect(s3Versions).to.not.equal(undefined);
expect(Array.isArray(s3Versions), JSON.stringify(s3Versions)).to.equal(true);
expect(s3Versions.length).to.be.greaterThan(0);
sharedPewPewVersions = s3Versions;
expect(s3Versions).to.include(version);
} catch (error) {
log("deletePewPew after error", LogLevel.ERROR, error);
throw error;
}
});

describe("postPewPew", () => {
@@ -201,6 +215,27 @@ describe("PewPew Util Integration", () => {
});
});

describe("getPewPewVersionsInS3", () => {
it("getPewPewVersionsInS3() should return array with elements", (done: Mocha.Done) => {
getPewPewVersionsInS3().then((result: string[]) => {
log("getPewPewVersionsInS3()", LogLevel.DEBUG, result);
expect(result).to.not.equal(undefined);
expect(Array.isArray(result), JSON.stringify(result)).to.equal(true);
expect(result.length).to.be.greaterThan(0);
for (const version of result) {
if (version !== latestPewPewVersion) {
log(`semver.valid(${version}) = ${semver.valid(version)}`, LogLevel.DEBUG);
expect(semver.valid(version), `semver.valid(${version})`).to.not.equal(null);
}
}
if (!sharedPewPewVersions) {
sharedPewPewVersions = result;
}
done();
}).catch((error) => done(error));
});
});

describe("getPewpew", () => {
before(async () => {
try {
2 changes: 1 addition & 1 deletion controller/integration/testmanager.spec.ts
Original file line number Diff line number Diff line change
@@ -124,7 +124,7 @@ describe("TestManager Integration", () => {
expect(sharedPewPewVersions, "sharedPewPewVersions").to.not.equal(undefined);
expect(sharedPewPewVersions!.length, "sharedPewPewVersions.length").to.be.greaterThan(0);
numberedVersion = sharedPewPewVersions!.find((pewpewVersion: string) => pewpewVersion !== latestPewPewVersion);
expect(numberedVersion).to.not.equal(undefined);
expect(numberedVersion, "numberedVersion").to.not.equal(undefined);
log("numberedVersion", LogLevel.DEBUG, { numberedVersion });
const basicFilenameWithEnv = path.basename(BASIC_FILEPATH_WITH_ENV);
const ppaasTestIdWithEnv: PpaasTestId = PpaasTestId.makeTestId(basicFilenameWithEnv);