Skip to content

Commit

Permalink
[RFR] Bring back svn tests (#946)
Browse files Browse the repository at this point in the history
* update cypress config

Signed-off-by: Alejandro Brugarolas <[email protected]>

* bring back svn tests

Signed-off-by: Alejandro Brugarolas <[email protected]>

---------

Signed-off-by: Alejandro Brugarolas <[email protected]>
  • Loading branch information
abrugaro authored Feb 2, 2024
1 parent 6e81ddd commit 2bf3553
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 59 deletions.
2 changes: 2 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export default defineConfig({
pass: "Dog8code",
git_user: "",
git_password: "",
svn_user: "qe-admin",
svn_password: "Dog8code",
jira_stage_datacenter_url: "https://issues.stage.redhat.com/",
jira_stage_bearer_token: "",
jira_stage_basic_login: "",
Expand Down
72 changes: 33 additions & 39 deletions cypress/e2e/tests/administration/repository/subversion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,35 @@ import {
getRandomAnalysisData,
getRandomApplicationData,
login,
resetURL,
writeMavenSettingsFile,
} from "../../../../utils/utils";
import * as data from "../../../../utils/data_utils";
import { SubversionConfiguration } from "../../../models/administration/repositories/subversion";
import { CredentialsSourceControlUsername } from "../../../models/administration/credentials/credentialsSourceControlUsername";
import { button, CredentialType, SEC, UserCredentials } from "../../../types/constants";
import {
AnalysisStatuses,
button,
CredentialType,
SEC,
UserCredentials,
} from "../../../types/constants";
import { Analysis } from "../../../models/migration/applicationinventory/analysis";
import { footer } from "../../../views/common.view";

let subversionConfiguration = new SubversionConfiguration();
let source_credential: CredentialsSourceControlUsername;
let applicationsList: Analysis[] = [];
import { getDescription, getRandomWord } from "../../../../utils/data_utils";

describe(["@tier1"], "Test secure and insecure svn repository analysis", () => {
const subversionConfiguration = new SubversionConfiguration();
let sourceCredential: CredentialsSourceControlUsername;
let applicationsList: Analysis[] = [];

before("Login", function () {
login();
source_credential = new CredentialsSourceControlUsername(
data.getRandomCredentialsData(
CredentialType.sourceControl,
UserCredentials.usernamePassword,
true
)
);
source_credential.create();
sourceCredential = new CredentialsSourceControlUsername({
type: CredentialType.sourceControl,
name: getRandomWord(6),
description: getDescription(),
username: Cypress.env("svn_user"),
password: Cypress.env("svn_password"),
});
sourceCredential.create();
});

beforeEach("Load data", function () {
Expand All @@ -56,61 +60,51 @@ describe(["@tier1"], "Test secure and insecure svn repository analysis", () => {
this.analysisData = analysisData;
});

// Interceptors
cy.intercept("POST", "/hub/application*").as("postApplication");
cy.intercept("GET", "/hub/application*").as("getApplication");
});

// test that when the insecure repository is enabled, then the analysis on a http repo should be completed successfully
// Skipped until a svn server is provided in https://issues.redhat.com/browse/MTA-1717
it.skip("Analysis on insecure subversion Repository(http) for tackle test app when insecure repository is allowed", function () {
it("Analysis on insecure SVN Repository(http) when allowed", function () {
subversionConfiguration.enableInsecureSubversionRepositories();

const application = new Analysis(
getRandomApplicationData("Secure_enabled_tackle_test_app", {
sourceData: this.appData["tackle-testapp-svn-insecure"],
getRandomApplicationData("Insecure svn enabled bookserver app", {
sourceData: this.appData["bookserver-svn-insecure"],
}),
getRandomAnalysisData(this.analysisData["source_analysis_on_bookserverapp"])
);
application.create();
applicationsList.push(application);
cy.wait("@getApplication");
cy.wait(2 * SEC);
application.manageCredentials(source_credential.name, null);
application.manageCredentials(sourceCredential.name, null);
application.analyze();
application.verifyAnalysisStatus("Completed");
application.openReport();
application.verifyAnalysisStatus(AnalysisStatuses.completed);
});

// Negative test case, when the insecure repository is disabled, then the analysis on a http repo should fail
it("Analysis on insecure subversion Repository(http) for tackle test app when insecure repository is not allowed", function () {
it("Analysis on insecure SVN Repository(http) when not allowed", function () {
subversionConfiguration.disableInsecureSubversionRepositories();

const application = new Analysis(
getRandomApplicationData("Secure_disabled_tackle_test_app", {
sourceData: this.appData["tackle-testapp-svn-insecure"],
getRandomApplicationData("Insecure svn disabled bookserver app", {
sourceData: this.appData["bookserver-svn-insecure"],
}),
getRandomAnalysisData(this.analysisData["source_analysis_on_bookserverapp"])
);
application.create();
applicationsList.push(application);
cy.wait("@getApplication");
cy.wait(2 * SEC);
application.manageCredentials(source_credential.name, null);
application.manageCredentials(sourceCredential.name, null);
application.analyze();
application.verifyAnalysisStatus("Failed");
application.verifyAnalysisStatus(AnalysisStatuses.failed);
application.openAnalysisDetails();
clickWithinByText(footer, button, "Close");
});

afterEach("Persist session", function () {
// Reset URL from report page to web UI
resetURL();
afterEach("Clear state", function () {
Analysis.open(true);
});

after("Perform test data clean up", () => {
deleteByList(applicationsList);
source_credential.delete();
writeMavenSettingsFile(data.getRandomWord(5), data.getRandomWord(5));
sourceCredential.delete();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -167,24 +167,6 @@ describe(["@tier1"], "Source Analysis", () => {
application.verifyAnalysisStatus("Completed");
});

// Skipped until a svn server is provided in https://issues.redhat.com/browse/MTA-1717
it.skip("Source Analysis on tackle testapp for svn repo type", function () {
// For tackle test app source credentials are required.
const application = new Analysis(
getRandomApplicationData("tackleTestApp_svnRepo", {
sourceData: this.appData["tackle-testapp-svn"],
}),
getRandomAnalysisData(this.analysisData["analysis_for_enableTagging"])
);
application.create();
applicationsList.push(application);
cy.wait("@getApplication");
cy.wait(2 * SEC);
application.manageCredentials(source_credential.name, null);
application.analyze();
application.verifyAnalysisStatus("Completed");
});

it("Analysis for known Open Source libraries on tackleTest app", function () {
// Source code analysis require both source and maven credentials
const application = new Analysis(
Expand Down
4 changes: 2 additions & 2 deletions cypress/fixtures/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"repoType": "Git",
"sourceRepo": "http://github.com/konveyor/tackle-testapp"
},
"tackle-testapp-svn-insecure": {
"bookserver-svn-insecure": {
"repoType": "Subversion",
"sourceRepo": "http://github.com/konveyor/tackle-testapp"
"sourceRepo": "http://10.0.188.129/svn/mtaqe-svn/book-server"
},
"konveyor-exampleapp": {
"repoType": "Git",
Expand Down

0 comments on commit 2bf3553

Please sign in to comment.