Skip to content

Commit

Permalink
WIP test against the lmars-dev cluster
Browse files Browse the repository at this point in the history
Signed-off-by: Lewis Marshall <[email protected]>
  • Loading branch information
lmars committed Jul 3, 2024
1 parent a6e5f23 commit b4bc092
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion test/common/globals/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
define(function (require) {
var defaultLogLevel = 4,
environment = isBrowser ? window.__env__ || {} : process.env,
ablyEnvironment = environment.ABLY_ENV || 'sandbox',
ablyEnvironment = environment.ABLY_ENV || 'lmars-dev',
realtimeHost = environment.ABLY_REALTIME_HOST,
restHost = environment.ABLY_REST_HOST,
port = environment.ABLY_PORT || 80,
Expand Down
2 changes: 1 addition & 1 deletion test/package/browser/template/playwright/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ beforeMount(async ({ App }) => {

const client = new Ably.Realtime({
key,
environment: 'sandbox',
environment: 'lmars-dev',
});

return (
Expand Down
2 changes: 1 addition & 1 deletion test/package/browser/template/src/index-default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async function attachChannel(channel: Ably.RealtimeChannel) {
globalThis.testAblyPackage = async function () {
const key = await createSandboxAblyAPIKey();

const realtime = new Ably.Realtime({ key, environment: 'sandbox' });
const realtime = new Ably.Realtime({ key, environment: 'lmars-dev' });

const channel = realtime.channels.get('channel');
await attachChannel(channel);
Expand Down
2 changes: 1 addition & 1 deletion test/package/browser/template/src/index-modular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function checkStandaloneFunction() {
globalThis.testAblyPackage = async function () {
const key = await createSandboxAblyAPIKey();

const realtime = new BaseRealtime({ key, environment: 'sandbox', plugins: { WebSocketTransport, FetchRequest } });
const realtime = new BaseRealtime({ key, environment: 'lmars-dev', plugins: { WebSocketTransport, FetchRequest } });

const channel = realtime.channels.get('channel');
await attachChannel(channel);
Expand Down
2 changes: 1 addition & 1 deletion test/package/browser/template/src/sandbox.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import testAppSetup from '../../../../common/ably-common/test-resources/test-app-setup.json';

export async function createSandboxAblyAPIKey() {
const response = await fetch('https://sandbox-rest.ably.io/apps', {
const response = await fetch('https://lmars-dev-rest.ably.io/apps', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(testAppSetup.post_apps),
Expand Down
2 changes: 1 addition & 1 deletion test/realtime/connectivity.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) {

it('succeeds with plain url', function (done) {
whenPromiseSettles(
new helper.AblyRealtime(options('sandbox-rest.ably.io/time')).http.checkConnectivity(),
new helper.AblyRealtime(options('lmars-dev-rest.ably.io/time')).http.checkConnectivity(),
function (err, res) {
try {
expect(res && !err, 'Connectivity check completed ' + (err && utils.inspectError(err))).to.be.ok;
Expand Down
28 changes: 14 additions & 14 deletions test/rest/defaults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ define(['ably', 'chai'], function (Ably, chai) {
});

it('Init with given environment', function () {
var normalisedOptions = Defaults.normaliseOptions({ environment: 'sandbox' }, null, null);
var normalisedOptions = Defaults.normaliseOptions({ environment: 'lmars-dev' }, null, null);

expect(normalisedOptions.restHost).to.equal('sandbox-rest.ably.io');
expect(normalisedOptions.realtimeHost).to.equal('sandbox-realtime.ably.io');
expect(normalisedOptions.restHost).to.equal('lmars-dev-rest.ably.io');
expect(normalisedOptions.realtimeHost).to.equal('lmars-dev-realtime.ably.io');
expect(normalisedOptions.port).to.equal(80);
expect(normalisedOptions.tlsPort).to.equal(443);
expect(normalisedOptions.fallbackHosts.sort()).to.deep.equal(Defaults.environmentFallbackHosts('sandbox').sort());
expect(normalisedOptions.fallbackHosts.sort()).to.deep.equal(Defaults.environmentFallbackHosts('lmars-dev').sort());
expect(normalisedOptions.tls).to.equal(true);

expect(Defaults.getHosts(normalisedOptions).length).to.deep.equal(4);
expect(Defaults.getHosts(normalisedOptions)[0]).to.deep.equal(normalisedOptions.restHost);
expect(Defaults.getHost(normalisedOptions, 'sandbox-rest.ably.io', false)).to.deep.equal('sandbox-rest.ably.io');
expect(Defaults.getHost(normalisedOptions, 'sandbox-rest.ably.io', true)).to.deep.equal(
'sandbox-realtime.ably.io',
expect(Defaults.getHost(normalisedOptions, 'lmars-dev-rest.ably.io', false)).to.deep.equal('lmars-dev-rest.ably.io');
expect(Defaults.getHost(normalisedOptions, 'lmars-dev-rest.ably.io', true)).to.deep.equal(
'lmars-dev-realtime.ably.io',
);

expect(Defaults.getPort(normalisedOptions)).to.equal(443);
Expand Down Expand Up @@ -122,21 +122,21 @@ define(['ably', 'chai'], function (Ably, chai) {
});

it('Init with no endpoint-related options and given default environment', function () {
Defaults.ENVIRONMENT = 'sandbox';
Defaults.ENVIRONMENT = 'lmars-dev';
var normalisedOptions = Defaults.normaliseOptions({}, null, null);

expect(normalisedOptions.restHost).to.equal('sandbox-rest.ably.io');
expect(normalisedOptions.realtimeHost).to.equal('sandbox-realtime.ably.io');
expect(normalisedOptions.restHost).to.equal('lmars-dev-rest.ably.io');
expect(normalisedOptions.realtimeHost).to.equal('lmars-dev-realtime.ably.io');
expect(normalisedOptions.port).to.equal(80);
expect(normalisedOptions.tlsPort).to.equal(443);
expect(normalisedOptions.fallbackHosts.sort()).to.deep.equal(Defaults.environmentFallbackHosts('sandbox').sort());
expect(normalisedOptions.fallbackHosts.sort()).to.deep.equal(Defaults.environmentFallbackHosts('lmars-dev').sort());
expect(normalisedOptions.tls).to.equal(true);

expect(Defaults.getHosts(normalisedOptions).length).to.equal(4);
expect(Defaults.getHosts(normalisedOptions)[0]).to.deep.equal(normalisedOptions.restHost);
expect(Defaults.getHost(normalisedOptions, 'sandbox-rest.ably.io', false)).to.deep.equal('sandbox-rest.ably.io');
expect(Defaults.getHost(normalisedOptions, 'sandbox-rest.ably.io', true)).to.deep.equal(
'sandbox-realtime.ably.io',
expect(Defaults.getHost(normalisedOptions, 'lmars-dev-rest.ably.io', false)).to.deep.equal('lmars-dev-rest.ably.io');
expect(Defaults.getHost(normalisedOptions, 'lmars-dev-rest.ably.io', true)).to.deep.equal(
'lmars-dev-realtime.ably.io',
);

expect(Defaults.getPort(normalisedOptions)).to.equal(443);
Expand Down

0 comments on commit b4bc092

Please sign in to comment.