Skip to content

Commit

Permalink
Merge branch 'main' into chore/golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp committed Dec 26, 2023
2 parents ff78e05 + a45b999 commit beeb2c2
Show file tree
Hide file tree
Showing 224 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion config/generation.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const patterns = [
'clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/**',

'tests/output/kotlin/src/commonTest/kotlin/com/algolia/client/**',
'tests/output/kotlin/src/commonTest/kotlin/com/algolia/methods/requests/**',
'tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/**',

// Dart
'!clients/algoliasearch-client-dart/**',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class GoCTSManager implements CTSManager {

@Override
public void addSupportingFiles(List<SupportingFile> supportingFiles) {
supportingFiles.add(new SupportingFile("common.mustache", "tests/methods/requests", "common.go"));
supportingFiles.add(new SupportingFile("common.mustache", "tests/requests", "common.go"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public PythonCTSManager(String client) {

@Override
public void addSupportingFiles(List<SupportingFile> supportingFiles) {
supportingFiles.add(new SupportingFile("__init__.mustache", "tests/methods/", "__init__.py"));
supportingFiles.add(new SupportingFile("__init__.mustache", "tests/methods/requests", "__init__.py"));
supportingFiles.add(new SupportingFile("__init__.mustache", "tests/", "__init__.py"));
supportingFiles.add(new SupportingFile("__init__.mustache", "tests/requests", "__init__.py"));
supportingFiles.add(new SupportingFile("__init__.mustache", "tests/client", "__init__.py"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected Map<String, Request[]> loadRequestCTS() throws Exception {
if ((language.equals("javascript") || language.equals("dart")) && client.equals("algoliasearch")) {
clientName = "search";
}
return super.loadCTS("methods/requests", clientName, Request[].class);
return super.loadCTS("requests", clientName, Request[].class);
}

@Override
Expand All @@ -36,11 +36,7 @@ public void addSupportingFiles(List<SupportingFile> supportingFiles, String outp
return;
}
supportingFiles.add(
new SupportingFile(
"requests/requests.mustache",
outputFolder + "/methods/requests",
Helpers.createClientName(client, language) + extension
)
new SupportingFile("requests/requests.mustache", outputFolder + "/requests", Helpers.createClientName(client, language) + extension)
);
}

Expand All @@ -58,7 +54,7 @@ public void run(Map<String, CodegenModel> models, Map<String, CodegenOperation>
"operationId '" +
operationId +
"' does not exist in the tests suite, please create the file:" +
" 'tests/CTS/methods/requests/" +
" 'tests/CTS/requests/" +
client +
"/" +
operationId +
Expand Down
6 changes: 3 additions & 3 deletions scripts/ci/githubActions/createMatrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ async function createClientMatrix(baseBranch: string): Promise<void> {
const testsRootFolder = `tests/output/${language}`;
const testsOutputBase = `${testsRootFolder}/${getTestOutputFolder(language)}`;
// We delete tests to ensure the CI only run tests against what changed.
const testsToDelete = `${testsOutputBase}/client ${testsOutputBase}/methods/requests`;
const testsToDelete = `${testsOutputBase}/client ${testsOutputBase}/requests`;

// We only store tests of clients that ran during this job, the rest stay as is
let testsToStore = matrix[language].toRun
.map((client) => {
const clientName = createClientName(client, language);
const extension = getTestExtension(language);

return `${testsOutputBase}/client/${clientName}${extension} ${testsOutputBase}/methods/requests/${clientName}${extension}`;
return `${testsOutputBase}/client/${clientName}${extension} ${testsOutputBase}/requests/${clientName}${extension}`;
})
.join(' ');

Expand All @@ -100,7 +100,7 @@ async function createClientMatrix(baseBranch: string): Promise<void> {
testsToStore = `${testsToStore} ${testsRootFolder}/build.gradle`;
break;
case 'go':
testsToStore = `${testsToStore} ${testsOutputBase}/methods/requests/common.go ${testsRootFolder}/go.sum ${testsRootFolder}/go.mod`;
testsToStore = `${testsToStore} ${testsOutputBase}/requests/common.go ${testsRootFolder}/go.sum ${testsRootFolder}/go.mod`;
break;
case 'javascript':
const npmNamespace = getClientsConfigField('javascript', 'npmNamespace');
Expand Down
4 changes: 2 additions & 2 deletions scripts/husky/__tests__/pre-commit.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('micromatch', () => {
'tests/output/javascript/package.json',
'tests/output/javascript/src/client/test.ts',

'tests/output/php/src/methods/requests/test.php',
'tests/output/php/src/requests/test.php',
],
getPatterns()
)
Expand All @@ -54,7 +54,7 @@ describe('micromatch', () => {
'tests/output/javascript/src/client/test.ts',
'tests/output/javascript/package.json',

'tests/output/php/src/methods/requests/test.php',
'tests/output/php/src/requests/test.php',
].sort()
);
});
Expand Down
2 changes: 1 addition & 1 deletion scripts/husky/pre-commit.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function getPatterns() {
const entries = patterns;
for (const [language, { tests }] of Object.entries(clientConfig)) {
entries.push(`tests/output/${language}/${tests.outputFolder}/client/**`);
entries.push(`tests/output/${language}/${tests.outputFolder}/methods/**`);
entries.push(`tests/output/${language}/${tests.outputFolder}/requests/**`);
}
return entries;
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions website/docs/contributing/testing/common-test-suite.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ There are differents type of tests in the CTS:

Those tests aims at ensuring minimal working operation for the API clients, by comparing the request formed by sample parameters.

The test generation script requires a JSON file name from the `operationId` (e.g. `search.json`), located in the `tests/CTS/methods/requests/<client>/` folder (e.g. `tests/CTS/methods/requests/search/`).
The test generation script requires a JSON file name from the `operationId` (e.g. `search.json`), located in the `tests/CTS/requests/<client>/` folder (e.g. `tests/CTS/requests/search/`).

> See the [browse test file for the search client](https://github.com/algolia/api-clients-automation/blob/main/tests/CTS/methods/requests/search/browse.json)
> See the [browse test file for the search client](https://github.com/algolia/api-clients-automation/blob/main/tests/CTS/requests/search/browse.json)
```json
[
Expand Down Expand Up @@ -254,7 +254,7 @@ If specific values are needed for a specific languages, or custom generated file

You might want to test how every clients behaves, without having to duplicate the same tests. We provide 4 methods on every clients, common to all languages.

You can find [the common folder](https://github.com/algolia/api-clients-automation/tree/main/tests/CTS/methods/requests/common) in the CTS too. [Adding a test](#how-to-add-test) in this folder will generate tests for all the clients.
You can find [the common folder](https://github.com/algolia/api-clients-automation/tree/main/tests/CTS/requests/common) in the CTS too. [Adding a test](#how-to-add-test) in this folder will generate tests for all the clients.

## Get the list of remaining CTS to implement

Expand Down

0 comments on commit beeb2c2

Please sign in to comment.