Skip to content

Commit

Permalink
Merge pull request #22674 from mshima/skip_ci-integration-test
Browse files Browse the repository at this point in the history
adjusts to integration test samples
  • Loading branch information
DanielFran authored Jun 26, 2023
2 parents eeea6f2 + d9c28ab commit 41ee0d1
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"serviceDiscoveryType": "consul",
"skipClient": true,
"skipUserManagement": true,
"testFrameworks": ["gatling", "cypress"],
"testFrameworks": ["gatling"],
"websocket": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"serviceDiscoveryType": "consul",
"skipClient": true,
"skipUserManagement": true,
"testFrameworks": ["gatling", "cypress"],
"testFrameworks": ["gatling"],
"websocket": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"serviceDiscoveryType": "eureka",
"skipClient": true,
"skipUserManagement": true,
"testFrameworks": ["gatling", "cypress"],
"testFrameworks": ["gatling"],
"websocket": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"serviceDiscoveryType": "eureka",
"skipClient": true,
"skipUserManagement": true,
"testFrameworks": ["gatling", "cypress"],
"testFrameworks": ["gatling"],
"websocket": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"serviceDiscoveryType": "consul",
"skipClient": true,
"skipUserManagement": true,
"testFrameworks": ["gatling", "cypress"],
"testFrameworks": ["gatling"],
"websocket": false
}
}
2 changes: 1 addition & 1 deletion test-integration/daily-builds/ms-micro-consul/.yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"serviceDiscoveryType": "consul",
"skipClient": true,
"skipUserManagement": true,
"testFrameworks": ["gatling", "cypress"],
"testFrameworks": ["gatling"],
"websocket": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"serviceDiscoveryType": "eureka",
"skipClient": true,
"skipUserManagement": true,
"testFrameworks": ["gatling", "cypress"],
"testFrameworks": ["gatling"],
"websocket": false
}
}
2 changes: 1 addition & 1 deletion test-integration/daily-builds/ms-micro-eureka/.yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"serviceDiscoveryType": "eureka",
"skipClient": true,
"skipUserManagement": true,
"testFrameworks": ["gatling", "cypress"],
"testFrameworks": ["gatling"],
"websocket": false
}
}
1 change: 0 additions & 1 deletion test-integration/samples/ms-micro-consul/.yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"baseName": "sampleMicroserviceConsul",
"buildTool": "maven",
"cacheProvider": "hazelcast",
"clientFramework": "angular",
"clientPackageManager": "npm",
"creationTimestamp": 1596513172471,
"databaseType": "sql",
Expand Down
1 change: 0 additions & 1 deletion test-integration/samples/ms-micro-eureka/.yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"baseName": "sampleMicroserviceEureka",
"buildTool": "maven",
"cacheProvider": "hazelcast",
"clientFramework": "angular",
"clientPackageManager": "npm",
"creationTimestamp": 1596513172471,
"databaseType": "sql",
Expand Down
46 changes: 46 additions & 0 deletions test/integration-test.spec.mts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ describe('integration-test', () => {
describe('::application samples', () => {
for (const [name, yoFile] of [...itSamplesEntries, ...dailyBuildEntries]) {
let yoJson = fse.readJsonSync(yoFile);
const writeConfig = () => fse.writeJsonSync(yoFile, yoJson);
const config = yoJson['generator-jhipster'];
describe(`${name} test`, () => {
before(() => {
Expand Down Expand Up @@ -103,6 +104,51 @@ describe('integration-test', () => {
it('should be ordered', () => {
assert(JSON.stringify(yoJson) === JSON.stringify(sortKeys(yoJson, { deep: true })));
});
it('should have matching skipClient/clientFrameworkNo', () => {
const clientFrameworkNo = config.clientFramework === 'no';
const clientFrameworkAny = config.clientFramework && config.clientFramework !== 'no';
if (clientFrameworkAny && config.skipClient) {
if (fixSamples) {
if (config.microfrontend) {
delete config.skipClient;
} else {
delete config.clientFramework;
}
writeConfig();
} else {
throw new Error('Conflict');
}
}
if (clientFrameworkNo) {
if (config.skipClient === false) {
if (fixSamples) {
delete config.skipClient;
writeConfig();
} else {
throw new Error('Conflict');
}
}
if (config.microfrontend) {
if (fixSamples) {
delete config.microfrontend;
writeConfig();
} else {
throw new Error('Conflict');
}
}
}
});
it('cypress should not added to skipClient and clientFrameworkNo', () => {
if (config.skipClient || config.clientFramework === 'no') {
const includesCypress = config.testFrameworks?.includes('cypress');
if (fixSamples && includesCypress) {
config.testFrameworks = config.testFrameworks.filter(test => test !== 'cypress');
writeConfig();
} else {
assert(!includesCypress);
}
}
});
});
}
});
Expand Down

0 comments on commit 41ee0d1

Please sign in to comment.