Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: us-east-1 is not supported, resolves #244 #243

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apis/builds.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"region": {
"default": "us-west-1",
"description": "region of datacenter",
"enum": ["us-west-1", "us-east-1", "eu-central-1", "staging"]
"enum": ["us-west-1", "us-east-4", "eu-central-1", "staging"]
},
"tld": {
"default": "com",
Expand Down
2 changes: 1 addition & 1 deletion apis/sauce.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"region": {
"default": "us-west-1",
"description": "region of datacenter",
"enum": ["us-west-1", "us-east-1", "eu-central-1", "staging"]
"enum": ["us-west-1", "us-east-4", "eu-central-1", "staging"]
},
"tld": {
"default": "com",
Expand Down
2 changes: 1 addition & 1 deletion apis/teamManagement.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"region": {
"default": "us-west-1",
"description": "region of datacenter",
"enum": ["us-west-1", "us-east-1", "eu-central-1", "staging"]
"enum": ["us-west-1", "us-east-4", "eu-central-1", "staging"]
},
"tld": {
"default": "com",
Expand Down
2 changes: 1 addition & 1 deletion scripts/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface SauceLabsOptions {
*
* - us-west-1 (short 'us')
* - eu-central-1 (short 'eu')
* - us-east-1 (headless)
* - us-east-4
*/
region?: ${regions};
/**
Expand Down
2 changes: 1 addition & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const ASSET_REGION_MAPPING = {
us: '',
eu: 'eu-central-1.',
'us-west-1': '',
'us-east-1': 'us-east-1.',
'us-east-4': 'us-east-4.',
'eu-central-1': 'eu-central-1.',
staging: 'staging.',
};
Expand Down
9 changes: 2 additions & 7 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export function getRegionSubDomain(options = {}) {

if (options.region === 'us') region = 'us-west-1';
if (options.region === 'eu') region = 'eu-central-1';
if (options.headless) region = 'us-east-1';
return region;
}

Expand All @@ -46,7 +45,7 @@ export function getRegionSubDomain(options = {}) {
* @param {string} servers OpenAPI spec servers property
* @param {string} basePath OpenAPI spec base path
* @param {object} options client options
* @return {string} endpoint base url (e.g. `https://us-east1.headless.saucelabs.com`)
* @return {string} endpoint base url (e.g. `https://api.us-east-4.saucelabs.com`)
*/
export function getAPIHost(servers, basePath, options) {
/**
Expand Down Expand Up @@ -86,14 +85,10 @@ export function getAPIHost(servers, basePath, options) {
* helper to generate host for assets, like:
* https://assets.saucelabs.com/jobs/<jobId>/selenium-server.log
* https://assets.eu-central-1.saucelabs.com/jobs/<jobId>/log.json
* https://assets.us-east-1.saucelabs.com/jobs/<jobId>/log.json
* https://assets.us-east-4.saucelabs.com/jobs/<jobId>/log.json
* https://assets.staging.saucelabs.net/jobs/<jobId>/log.json
*/
export function getAssetHost(options) {
if (options.headless) {
options.region = 'us-east-1';
}

if (options.region === 'staging') {
options.tld = options.tld || 'net';
}
Expand Down
10 changes: 0 additions & 10 deletions tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,6 @@ test('should expose a webdriverEndpoint', () => {
'https://ondemand.eu-central-1.saucelabs.com/'
);

const api3 = new SauceLabs({
user: 'foo',
key: 'bar',
region: 'eu',
headless: true,
});
expect(api3.webdriverEndpoint).toBe(
'https://ondemand.us-east-1.saucelabs.com/'
);

const api4 = new SauceLabs({user: 'foo', key: 'bar', region: 'us-central-3'});
expect(api4.webdriverEndpoint).toBe(
'https://ondemand.us-central-3.saucelabs.com/'
Expand Down
17 changes: 4 additions & 13 deletions tests/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,8 @@ test('getAPIHost', () => {
getAPIHost(sauceAPI.servers, sauceAPI.basePath, {region: 'us-west-1'})
).toBe('https://api.us-west-1.saucelabs.com/rest');
expect(
getAPIHost(sauceAPI.servers, sauceAPI.basePath, {region: 'us-east-1'})
).toBe('https://api.us-east-1.saucelabs.com/rest');
expect(
getAPIHost(sauceAPI.servers, sauceAPI.basePath, {
region: 'us-west-1',
headless: true,
})
).toBe('https://api.us-east-1.saucelabs.com/rest');
getAPIHost(sauceAPI.servers, sauceAPI.basePath, {region: 'us-east-4'})
).toBe('https://api.us-east-4.saucelabs.com/rest');
expect(
getAPIHost(sauceAPI.servers, sauceAPI.basePath, {host: 'http://foobar.com'})
).toBe('http://foobar.com/rest');
Expand Down Expand Up @@ -91,11 +85,8 @@ test('getAssetHost', () => {
expect(getAssetHost({region: 'eu-central-1'})).toBe(
'https://assets.eu-central-1.saucelabs.com'
);
expect(getAssetHost({headless: true})).toBe(
'https://assets.us-east-1.saucelabs.com'
);
expect(getAssetHost({headless: true, region: 'eu'})).toBe(
'https://assets.us-east-1.saucelabs.com'
expect(getAssetHost({region: 'us-east-4'})).toBe(
'https://assets.us-east-4.saucelabs.com'
);
expect(getAssetHost({region: 'staging'})).toBe(
'https://assets.staging.saucelabs.net'
Expand Down
Loading