Skip to content

Commit 3104903

Browse files
authored
Merge branch 'main' into chore/renovateBaseBranch
2 parents 35fa9f0 + e279260 commit 3104903

File tree

138 files changed

+2103
-1339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+2103
-1339
lines changed

.github/ISSUE_TEMPLATE/Bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ body:
4343
id: client
4444
attributes:
4545
label: Client
46-
description: Which API are you targetting?
46+
description: Which API are you targeting?
4747
options:
4848
- All
4949
- AB testing

config/clients.config.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@
168168
"packageVersion": "5.5.3",
169169
"modelFolder": "model",
170170
"apiFolder": "src",
171-
"dockerImage": "apic_base",
172171
"tests": {
173172
"extension": ".test.ts",
174173
"outputFolder": "src"

docker-compose.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ services:
1313
- PHP_VERSION=${PHP_VERSION}
1414
- PYTHON_VERSION=${PYTHON_VERSION}
1515
command: tail -f /dev/null
16-
volumes: [./:/app]
16+
volumes: [ ./:/app ]
17+
1718
ruby:
1819
container_name: apic_ruby
1920
build:
@@ -24,7 +25,8 @@ services:
2425
- NODE_VERSION=${NODE_VERSION}
2526
- RUBY_VERSION=${RUBY_VERSION}
2627
command: tail -f /dev/null
27-
volumes: [./:/app]
28+
volumes: [ ./:/app ]
29+
2830
swift:
2931
container_name: apic_swift
3032
build:
@@ -35,4 +37,4 @@ services:
3537
- NODE_VERSION=${NODE_VERSION}
3638
- SWIFT_VERSION=${SWIFT_VERSION}
3739
command: tail -f /dev/null
38-
volumes: [./:/app]
40+
volumes: [ ./:/app ]

generators/src/main/java/com/algolia/codegen/cts/tests/TestsGenerator.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,11 @@ protected <T> Map<String, T[]> loadFullCTS(Class<T[]> jsonType) throws Exception
9595

9696
private String injectVariables(String json) {
9797
long threeDays = 3 * 24 * 60 * 60 * 1000;
98-
json = json
98+
return json
9999
.replace("${{language}}", language)
100100
.replace("${{languageCased}}", ctsManager.getLanguageCased())
101101
.replace("${{languageVersion}}", ctsManager.getVersion())
102102
.replace("${{clientPascalCase}}", Helpers.capitalize(Helpers.camelize(client)))
103103
.replace("\"${{nowRounded}}\"", String.valueOf(Math.round(System.currentTimeMillis() / threeDays) * threeDays));
104-
105-
if (!language.equals("javascript") && !"true".equals(System.getenv("CI"))) {
106-
// hack for docker on mac, the `network=host` does not work so we need to use
107-
// another local IP
108-
json = json.replace("${{localhost}}", "host.docker.internal");
109-
} else {
110-
json = json.replace("${{localhost}}", "localhost");
111-
}
112-
return json;
113104
}
114105
}

scripts/buildClients.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ async function buildLanguage(language: Language, gens: Generator[], buildType: B
2525
await run('go build ./...', { cwd, language });
2626
break;
2727
case 'javascript':
28-
await run('YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install', { cwd });
28+
await run('YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install', { cwd, language });
2929
if (buildType === 'client') {
3030
const packageNames = gens.map(({ additionalProperties: { packageName } }) =>
3131
packageName === 'algoliasearch' ? packageName : `@algolia/${packageName}`,
3232
);
33-
await run(`yarn build:many '{${packageNames.join(',')},}'`, { cwd });
33+
await run(`yarn build:many '{${packageNames.join(',')},}'`, { cwd, language });
3434
}
3535

3636
break;

scripts/cts/runCts.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,13 @@ async function runCtsOne(language: Language, suites: Record<CTSType, boolean>):
5757
});
5858
break;
5959
case 'go':
60-
await run(`go test -race -count 1 ${isVerbose() ? '-v' : ''} ${filter((f) => `gotests/tests/${f}/...`)}`, {
61-
cwd,
62-
language,
63-
});
60+
await run(
61+
`go test ${suites.benchmark ? '' : '-race'} -count 1 ${isVerbose() ? '-v' : ''} ${filter((f) => `gotests/tests/${f}/...`)}`,
62+
{
63+
cwd,
64+
language,
65+
},
66+
);
6467
break;
6568
case 'java':
6669
await run(`./gradle/gradlew -p tests/output/java test --rerun ${filter((f) => `--tests 'com.algolia.${f}*'`)}`, {
@@ -70,6 +73,7 @@ async function runCtsOne(language: Language, suites: Record<CTSType, boolean>):
7073
case 'javascript':
7174
await run(`YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install && yarn test ${filter((f) => `src/${f}`)}`, {
7275
cwd,
76+
language,
7377
});
7478
break;
7579
case 'kotlin':

scripts/cts/testServer/benchmark.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ export function printBenchmarkReport(): void {
2222
const times: Array<{ lang: string; rate: number }> = [];
2323
for (const lang of Object.keys(benchmarkStatus)) {
2424
const status = benchmarkStatus[lang];
25-
expect(status.requestTimes).to.have.length(1000);
26-
const rate = 1000000 / (status.requestTimes.at(-1)! - status.requestTimes[0]);
25+
expect(status.requestTimes).to.have.length(2000);
26+
status.requestTimes.sort((a, b) => a - b);
27+
const rate = (status.requestTimes.length * 1000) / (status.requestTimes.at(-1)! - status.requestTimes[0]);
2728
times.push({ lang, rate });
2829
}
2930

scripts/cts/testServer/timeout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function assertValidTimeouts(expectedCount: number): void {
4242
break;
4343
default:
4444
// the delay should be the same, because the `retryCount` is per host instead of global
45-
expect(state.duration[3 * i]).to.be.closeTo(state.duration[3 * i + 1], 100);
45+
expect(state.duration[3 * i]).to.be.closeTo(state.duration[3 * i + 1], 150);
4646
break;
4747
}
4848
}

scripts/formatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export async function formatter(language: string, cwd: string): Promise<void> {
3737
);
3838
break;
3939
case 'javascript':
40-
await run(`yarn eslint --ext=ts,json ${cwd} --fix --no-error-on-unmatched-pattern`);
40+
await run(`yarn eslint --ext=ts,json ${cwd} --fix --no-error-on-unmatched-pattern`, { language });
4141
break;
4242
case 'kotlin':
4343
await run(`./gradle/gradlew -p ${cwd} spotlessApply`, { language });

scripts/playground.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function playground({ language, client }: { language: AllLanguage;
1313
});
1414
break;
1515
case 'javascript':
16-
await run(`yarn workspace javascript-playground start ${client}`);
16+
await run(`yarn workspace javascript-playground start ${client}`, { language });
1717
break;
1818
case 'java':
1919
await run(

0 commit comments

Comments
 (0)