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(

templates/csharp/tests/client/createClient.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
{{#customHosts}}new () {
66
Scheme = HttpScheme.Http,
7-
Url = "{{host}}",
7+
Url = Environment.GetEnvironmentVariable("CI") == "true" ? "localhost" : "host.docker.internal",
88
Port = {{port}},
99
Up = true,
1010
LastUse = DateTime.UtcNow,

templates/csharp/tests/e2e/e2e.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Algolia.Search.e2e;
1919

2020
public class {{client}}RequestTestsE2E
2121
{
22-
private readonly {{client}} client;
22+
private readonly {{client}} client;
2323

2424
public {{client}}RequestTestsE2E()
2525
{

templates/dart/tests/client/client.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import '{{{import}}}';
33
import 'package:algolia_test/algolia_test.dart';
44
import 'package:test/test.dart';
55
import 'package:test_api/hooks.dart';
6+
import 'dart:io' show Platform;
67

78
void main() {
89
{{#blocksClient}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{^autoCreateClient}}final client = {{/autoCreateClient}}{{client}}(appId : "{{parametersWithDataTypeMap.appId.value}}", apiKey : "{{parametersWithDataTypeMap.apiKey.value}}",{{#hasRegionalHost}}{{#parametersWithDataTypeMap.region}}region: '{{parametersWithDataTypeMap.region.value}}',{{/parametersWithDataTypeMap.region}}{{/hasRegionalHost}}options: ClientOptions({{#useEchoRequester}}requester: requester{{/useEchoRequester}}{{#hasCustomHosts}}hosts:[{{#customHosts}}Host.create(url: '{{host}}:{{port}}', scheme: 'http'),{{/customHosts}}]{{/hasCustomHosts}}));
1+
{{^autoCreateClient}}final client = {{/autoCreateClient}}{{client}}(appId : "{{parametersWithDataTypeMap.appId.value}}", apiKey : "{{parametersWithDataTypeMap.apiKey.value}}",{{#hasRegionalHost}}{{#parametersWithDataTypeMap.region}}region: '{{parametersWithDataTypeMap.region.value}}',{{/parametersWithDataTypeMap.region}}{{/hasRegionalHost}}options: ClientOptions({{#useEchoRequester}}requester: requester{{/useEchoRequester}}{{#hasCustomHosts}}hosts:[{{#customHosts}}Host.create(url: (Platform.environment['CI'] == 'true' ? 'localhost' : 'host.docker.internal') + ':{{port}}', scheme: 'http'),{{/customHosts}}]{{/hasCustomHosts}}));

templates/go/tests/client/benchmark.mustache

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,6 @@ import (
1414
"github.com/algolia/algoliasearch-client-go/v4/algolia/call"
1515
)
1616

17-
func create{{#lambda.titlecase}}{{clientPrefix}}{{/lambda.titlecase}}Client(t *testing.T) (*{{clientPrefix}}.APIClient, *tests.EchoRequester) {
18-
echo := &tests.EchoRequester{}
19-
cfg := {{clientPrefix}}.{{clientName}}Configuration{
20-
Configuration: transport.Configuration{
21-
AppID: "appID",
22-
ApiKey: "apiKey",
23-
Requester: echo,
24-
},{{#hasRegionalHost}}
25-
Region: {{clientPrefix}}.{{#lambda.uppercase}}{{defaultRegion}}{{/lambda.uppercase}},{{/hasRegionalHost}}
26-
}
27-
client, err := {{clientPrefix}}.NewClientWithConfig(cfg)
28-
require.NoError(t, err)
29-
30-
return client, echo
31-
}
32-
3317
{{#blocksBenchmark}}
3418
{{> tests/client/tests}}
3519
{{/blocksBenchmark}}

templates/go/tests/client/createClient.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cfg = {{clientPrefix}}.{{clientName}}Configuration{
66
Requester: echo,
77
{{/useEchoRequester}}
88
{{#hasCustomHosts}}
9-
Hosts: []transport.StatefulHost{ {{#customHosts}}transport.NewStatefulHost("http", "{{host}}:{{port}}", call.IsReadWrite),{{/customHosts}} },
9+
Hosts: []transport.StatefulHost{ {{#customHosts}}transport.NewStatefulHost("http", tests.GetLocalhost() + ":{{port}}", call.IsReadWrite),{{/customHosts}} },
1010
{{/hasCustomHosts}}
1111
{{#gzipEncoding}}
1212
Compression: compression.GZIP,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{^autoCreateClient}}{{client}} client = {{/autoCreateClient}}new {{client}}("{{parametersWithDataTypeMap.appId.value}}","{{parametersWithDataTypeMap.apiKey.value}}"{{#hasRegionalHost}}{{#parametersWithDataTypeMap.region}},"{{parametersWithDataTypeMap.region.value}}"{{/parametersWithDataTypeMap.region}}{{/hasRegionalHost}}{{#useEchoRequester}},withEchoRequester(){{/useEchoRequester}}{{#hasCustomHosts}},withCustomHosts(Arrays.asList({{#customHosts}}new Host("{{host}}", EnumSet.of(CallType.READ, CallType.WRITE), "http", {{port}}){{^-last}},{{/-last}}{{/customHosts}}), {{gzipEncoding}}){{/hasCustomHosts}});
1+
{{^autoCreateClient}}{{client}} client = {{/autoCreateClient}}new {{client}}("{{parametersWithDataTypeMap.appId.value}}","{{parametersWithDataTypeMap.apiKey.value}}"{{#hasRegionalHost}}{{#parametersWithDataTypeMap.region}},"{{parametersWithDataTypeMap.region.value}}"{{/parametersWithDataTypeMap.region}}{{/hasRegionalHost}}{{#useEchoRequester}},withEchoRequester(){{/useEchoRequester}}{{#hasCustomHosts}},withCustomHosts(Arrays.asList({{#customHosts}}new Host("true".equals(System.getenv("CI")) ? "localhost" : "host.docker.internal", EnumSet.of(CallType.READ, CallType.WRITE), "http", {{port}}){{^-last}},{{/-last}}{{/customHosts}}), {{gzipEncoding}}){{/hasCustomHosts}});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{^autoCreateClient}}const client = {{/autoCreateClient}}{{client}}('{{parametersWithDataTypeMap.appId.value}}','{{parametersWithDataTypeMap.apiKey.value}}',{{#hasRegionalHost}}'{{parametersWithDataTypeMap.region.value}}',{{/hasRegionalHost}}{ {{#useEchoRequester}}requester: nodeEchoRequester(),{{/useEchoRequester}}{{#hasCustomHosts}}hosts:[{{#customHosts}}{ url: '{{host}}', port: {{port}}, accept: 'readWrite', protocol: 'http' },{{/customHosts}}]{{/hasCustomHosts}} });
1+
{{^autoCreateClient}}const client = {{/autoCreateClient}}{{client}}('{{parametersWithDataTypeMap.appId.value}}','{{parametersWithDataTypeMap.apiKey.value}}',{{#hasRegionalHost}}'{{parametersWithDataTypeMap.region.value}}',{{/hasRegionalHost}}{ {{#useEchoRequester}}requester: nodeEchoRequester(),{{/useEchoRequester}}{{#hasCustomHosts}}hosts:[{{#customHosts}}{ url: 'localhost', port: {{port}}, accept: 'readWrite', protocol: 'http' },{{/customHosts}}]{{/hasCustomHosts}} });
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{^autoCreateClient}}val client = {{/autoCreateClient}}{{client}}(appId = "{{parametersWithDataTypeMap.appId.value}}", apiKey = "{{parametersWithDataTypeMap.apiKey.value}}",{{#hasRegionalHost}}{{#parametersWithDataTypeMap.region}}"{{parametersWithDataTypeMap.region.value}}",{{/parametersWithDataTypeMap.region}}{{/hasRegionalHost}}{{#hasCustomHosts}}options = ClientOptions(hosts = listOf({{#customHosts}}Host(url = "{{host}}", protocol = "http", port = {{port}}){{^-last}},{{/-last}}{{/customHosts}}){{#gzipEncoding}}, compressionType = CompressionType.GZIP{{/gzipEncoding}}){{/hasCustomHosts}})
1+
{{^autoCreateClient}}val client = {{/autoCreateClient}}{{client}}(appId = "{{parametersWithDataTypeMap.appId.value}}", apiKey = "{{parametersWithDataTypeMap.apiKey.value}}",{{#hasRegionalHost}}{{#parametersWithDataTypeMap.region}}"{{parametersWithDataTypeMap.region.value}}",{{/parametersWithDataTypeMap.region}}{{/hasRegionalHost}}{{#hasCustomHosts}}options = ClientOptions(hosts = listOf({{#customHosts}}Host(url = if (System.getenv("CI") == "true") "localhost" else "host.docker.internal", protocol = "http", port = {{port}}){{^-last}},{{/-last}}{{/customHosts}}){{#gzipEncoding}}, compressionType = CompressionType.GZIP{{/gzipEncoding}}){{/hasCustomHosts}})

templates/kotlin/tests/client/tests.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fun `{{#lambda.replaceBacktick}}{{{testName}}}{{/lambda.replaceBacktick}}`() = r
1111
{{#isError}}
1212
assertFails {
1313
{{#dynamicTemplate}}{{/dynamicTemplate}}
14-
}.let { error -> assertError(error, "{{{expectedError}}}") }
14+
}.let { error -> assertError(error, "{{{expectedError}}}".replace("%localhost%", if (System.getenv("CI") == "true") "localhost" else "host.docker.internal")) }
1515
{{/isError}}
1616
{{^isError}}
1717
{{#isCreateClient}}

templates/php/tests/client/createClient.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ $client = $this->createClient(
55
{{#parametersWithDataTypeMap.region}}"{{parametersWithDataTypeMap.region.value}}"{{/parametersWithDataTypeMap.region}}{{^parametersWithDataTypeMap.region}}null{{/parametersWithDataTypeMap.region}}{{/hasRegionalHost}}
66
);
77
{{^isError}}$this->assertIsObject($client);{{/isError}}{{/useEchoRequester}}{{#hasCustomHosts}}
8-
$client = {{client}}::createWithConfig({{clientPrefix}}Config::create("{{parametersWithDataTypeMap.appId.value}}","{{parametersWithDataTypeMap.apiKey.value}}"{{#hasRegionalHost}}{{#parametersWithDataTypeMap.region}},"{{parametersWithDataTypeMap.region.value}}"{{/parametersWithDataTypeMap.region}}{{/hasRegionalHost}})->setFullHosts([{{#customHosts}}"http://{{host}}:{{port}}"{{^-last}},{{/-last}}{{/customHosts}}]));
8+
$client = {{client}}::createWithConfig({{clientPrefix}}Config::create("{{parametersWithDataTypeMap.appId.value}}","{{parametersWithDataTypeMap.apiKey.value}}"{{#hasRegionalHost}}{{#parametersWithDataTypeMap.region}},"{{parametersWithDataTypeMap.region.value}}"{{/parametersWithDataTypeMap.region}}{{/hasRegionalHost}})->setFullHosts([{{#customHosts}}"http://" . (getenv("CI") == "true" ? "localhost" : "host.docker.internal") . ":{{port}}"{{^-last}},{{/-last}}{{/customHosts}}]));
99
{{/hasCustomHosts}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
_config = {{#lambda.pascalcase}}{{clientPrefix}}Config{{/lambda.pascalcase}}("{{parametersWithDataTypeMap.appId.value}}", "{{parametersWithDataTypeMap.apiKey.value}}"{{#hasRegionalHost}}{{#parametersWithDataTypeMap.region}},"{{parametersWithDataTypeMap.region.value}}"{{/parametersWithDataTypeMap.region}}{{/hasRegionalHost}})
22
{{#hasCustomHosts}}
3-
{{#isError}} {{/isError}}_config.hosts = HostsCollection([{{#customHosts}}Host(url='{{host}}', scheme='http', port={{port}}){{^-last}},{{/-last}}{{/customHosts}}])
3+
{{#isError}} {{/isError}}_config.hosts = HostsCollection([{{#customHosts}}Host(url='localhost' if environ.get('CI') == 'true' else 'host.docker.internal', scheme='http', port={{port}}){{^-last}},{{/-last}}{{/customHosts}}])
44
{{/hasCustomHosts}}
55
{{#isError}} {{/isError}}_client = {{#lambda.pascalcase}}{{{client}}}{{/lambda.pascalcase}}{{#isSyncClient}}Sync{{/isSyncClient}}.create_with_config(config=_config{{#useEchoRequester}}, transporter=EchoTransporter{{#isSyncClient}}Sync{{/isSyncClient}}(_config){{/useEchoRequester}})

templates/ruby/tests/client/createClient.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
client = Algolia::{{#lambda.pascalcase}}{{{client}}}{{/lambda.pascalcase}}.create_with_config(Algolia::Configuration.new(
33
'{{parametersWithDataTypeMap.appId.value}}',
44
'{{parametersWithDataTypeMap.apiKey.value}}',
5-
[{{#customHosts}}Algolia::Transport::StatefulHost.new('{{host}}', protocol: 'http://', port: {{port}}, accept: CallType::READ | CallType::WRITE),{{/customHosts}}],
5+
[{{#customHosts}}Algolia::Transport::StatefulHost.new(ENV.fetch('CI', nil) == 'true' ? 'localhost' : 'host.docker.internal', protocol: 'http://', port: {{port}}, accept: CallType::READ | CallType::WRITE),{{/customHosts}}],
66
'{{client}}'{{#gzipEncoding}},
77
compression_type: 'gzip'{{/gzipEncoding}}
88
)){{/hasCustomHosts}}{{^hasCustomHosts}}

templates/ruby/tests/client/tests.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{{#dynamicTemplate}}{{/dynamicTemplate}}
1919
assert(false, 'An error should have been raised')
2020
rescue => e
21-
assert_equal({{#lambda.codeSnakeCase}}'{{{expectedError}}}'{{/lambda.codeSnakeCase}}, e.message)
21+
assert_equal({{#lambda.codeSnakeCase}}'{{{expectedError}}}'{{/lambda.codeSnakeCase}}.sub('%localhost%', ENV.fetch('CI', nil) == 'true' ? 'localhost' : 'host.docker.internal'), e.message)
2222
end
2323
{{/isError}}
2424
{{^isError}}

templates/scala/tests/client/createClient.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ val client = {{client}}(
66
{{#hasRegionalHost}}{{#parametersWithDataTypeMap.region}} region = {{#fallbackToAliasHost}}Option({{/fallbackToAliasHost}}"{{value}}"{{#fallbackToAliasHost}}){{/fallbackToAliasHost}},{{/parametersWithDataTypeMap.region}}{{/hasRegionalHost}}
77
clientOptions = ClientOptions
88
.builder()
9-
.withHosts(List({{#customHosts}}Host("{{host}}", Set(CallType.Read, CallType.Write), "http", Option({{port}})){{^-last}},{{/-last}}{{/customHosts}}))
9+
.withHosts(List({{#customHosts}}Host(if (System.getenv("CI") == "true") "localhost" else "host.docker.internal", Set(CallType.Read, CallType.Write), "http", Option({{port}})){{^-last}},{{/-last}}{{/customHosts}}))
1010
{{#gzipEncoding}}.withCompressionType(CompressionType.Gzip){{/gzipEncoding}}
1111
.build()
1212
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
let configuration = try {{client}}Configuration(appID: "{{parametersWithDataTypeMap.appId.value}}", apiKey: "{{parametersWithDataTypeMap.apiKey.value}}"{{#hasRegionalHost}}, region: {{#parametersWithDataTypeMap.region}}Region(rawValue: "{{parametersWithDataTypeMap.region.value}}"){{/parametersWithDataTypeMap.region}}{{^parametersWithDataTypeMap.region}}nil{{/parametersWithDataTypeMap.region}}{{/hasRegionalHost}}{{#hasCustomHosts}}, hosts: [{{#customHosts}}RetryableHost(url: URL(string: "http://{{host}}:{{port}}")!){{^-last}}, {{/-last}}{{/customHosts}}]{{/hasCustomHosts}}{{#gzipEncoding}}, compression: .gzip{{/gzipEncoding}})
1+
let configuration = try {{client}}Configuration(appID: "{{parametersWithDataTypeMap.appId.value}}", apiKey: "{{parametersWithDataTypeMap.apiKey.value}}"{{#hasRegionalHost}}, region: {{#parametersWithDataTypeMap.region}}Region(rawValue: "{{parametersWithDataTypeMap.region.value}}"){{/parametersWithDataTypeMap.region}}{{^parametersWithDataTypeMap.region}}nil{{/parametersWithDataTypeMap.region}}{{/hasRegionalHost}}{{#hasCustomHosts}}, hosts: [{{#customHosts}}RetryableHost(url: URL(string: "http://" + (ProcessInfo.processInfo.environment["CI"] == "true" ? "localhost" : "host.docker.internal") + ":{{port}}")!){{^-last}}, {{/-last}}{{/customHosts}}]{{/hasCustomHosts}}{{#gzipEncoding}}, compression: .gzip{{/gzipEncoding}})
22
let transporter: Transporter = Transporter(configuration: configuration{{#useEchoRequester}}, requestBuilder: EchoRequestBuilder(){{/useEchoRequester}})
33
{{^autoCreateClient}}let client = {{/autoCreateClient}}{{client}}(configuration: configuration, transporter: transporter)

tests/CTS/benchmark/search/benchmark.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"apiKey": "test-api-key",
1111
"customHosts": [
1212
{
13-
"host": "${{localhost}}",
1413
"port": 6682
1514
}
1615
]
@@ -19,7 +18,7 @@
1918
{
2019
"type": "method",
2120
"method": "search",
22-
"times": 1000,
21+
"times": 2000,
2322
"parameters": {
2423
"requests": [
2524
{

tests/CTS/client/common/setClientApiKey.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"region": "us",
1212
"customHosts": [
1313
{
14-
"host": "${{localhost}}",
1514
"port": 6683
1615
}
1716
]

0 commit comments

Comments
 (0)