Skip to content

Commit

Permalink
test: update runner environment with proper keys
Browse files Browse the repository at this point in the history
  • Loading branch information
parfeon committed Apr 22, 2024
1 parent db58678 commit 50ed4f7
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 34 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ defaults:
shell: bash
env:
CXX: 'g++-4.8'
PAM_SUBSCRIBE_KEY: ${{ secrets.TESTS_PAM_SUBSCRIBE_KEY }}
PAM_PUBLISH_KEY: ${{ secrets.TESTS_PAM_PUBLISH_KEY }}
SUBSCRIBE_KEY: ${{ secrets.TESTS_PUBLISH_KEY }}
PUBLISH_KEY: ${{ secrets.TESTS_SUBSCRIBE_KEY }}
PAM_SUBSCRIBE_KEY: ${{ secrets.SDK_PAM_SUB_KEY }}
PAM_PUBLISH_KEY: ${{ secrets.SDK_PAM_PUB_KEY }}
PAM_SECRET_KEY: ${{ secrets.SDK_PAM_SEC_KEY }}
SUBSCRIBE_KEY: ${{ secrets.SDK_SUB_KEY }}
PUBLISH_KEY: ${{ secrets.SDK_PUB_KEY }}

jobs:
tests:
Expand Down
6 changes: 3 additions & 3 deletions test/contract/shared/keysets.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Keyset } from './pubnub';

export class AccessManagerKeyset implements Keyset {
publishKey = process.env.PUBLISH_KEY_ACCESS || 'pub-key';
subscribeKey = process.env.SUBSCRIBE_KEY_ACCESS || 'sub-key';
secretKey = process.env.SECRET_KEY_ACCESS || 'secret-key';
subscribeKey = process.env.PAM_SUBSCRIBE_KEY || 'sub-key';
secretKey = process.env.PAM_SECRET_KEY || 'secret-key';
publishKey = process.env.PAM_PUBLISH_KEY || 'pub-key';
}

export class DemoKeyset implements Keyset {
Expand Down
7 changes: 2 additions & 5 deletions test/dist/objectsv2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ chai.use(chaiAsPromised);
chai.use(chaiNock);

describe('Objects V2 system tests', () => {
const SUBSCRIBE_KEY = 'sub-c-d86a1698-889e-11ea-b883-d2d532c9a1bf';
const PUBLISH_KEY = 'pub-c-5397272a-7664-4b57-bc91-944977fb3f25';

const TEST_PREFIX = 'objectsV2tests';
const UUID = `${TEST_PREFIX}-main`;
const UUID_1 = `${TEST_PREFIX}-uuid-1`;
Expand All @@ -32,8 +29,8 @@ describe('Objects V2 system tests', () => {

before(() => {
pubnub = new PubNub({
subscribeKey: SUBSCRIBE_KEY,
publishKey: PUBLISH_KEY,
subscribeKey: process.env.SUBSCRIBE_KEY || 'demo',
publishKey: process.env.PUBLISH_KEY || 'demo',
uuid: UUID,
// logVerbosity: true
});
Expand Down
11 changes: 4 additions & 7 deletions test/feature/file_upload.node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ chai.use(chaiAsPromised);
chai.use(chaiNock);

describe('File Upload API v1 tests', () => {
const SUBSCRIBE_KEY = 'demo';
const PUBLISH_KEY = 'demo';

const ORIGIN = undefined;

const TEST_PREFIX = 'javascript-fileUploadApiV1-tests';
Expand All @@ -29,8 +26,8 @@ describe('File Upload API v1 tests', () => {

describe('with encryption', () => {
pubnub = new PubNub({
subscribeKey: SUBSCRIBE_KEY,
publishKey: PUBLISH_KEY,
subscribeKey: process.env.SUBSCRIBE_KEY || 'demo',
publishKey: process.env.PUBLISH_KEY || 'demo',
uuid: UUID,
origin: ORIGIN,
cipherKey: 'abcdef',
Expand All @@ -42,8 +39,8 @@ describe('File Upload API v1 tests', () => {

describe('without encryption', () => {
pubnub = new PubNub({
subscribeKey: SUBSCRIBE_KEY,
publishKey: PUBLISH_KEY,
subscribeKey: process.env.SUBSCRIBE_KEY || 'demo',
publishKey: process.env.PUBLISH_KEY || 'demo',
origin: ORIGIN,
uuid: UUID,
});
Expand Down
17 changes: 7 additions & 10 deletions test/feature/file_upload.web.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ function urlToFile(url, filename, mimeType) {
}

describe('test', () => {
const SUBSCRIBE_KEY = 'demo-36';
const PUBLISH_KEY = 'demo-36';

const TEST_PREFIX = 'javascript-fileUploadApiV1-tests';
const UUID = `${TEST_PREFIX}-main`;
const UUID_1 = `${TEST_PREFIX}-uuid-1`;
Expand All @@ -24,7 +21,7 @@ describe('test', () => {

const FILE_1 = `${TEST_PREFIX}-file-1`;

let pubnub ;
let pubnub;

after(() => {
pubnub.unsubscribeAll();
Expand All @@ -33,8 +30,8 @@ describe('test', () => {

describe('with encryption', () => {
pubnub = new PubNub({
subscribeKey: SUBSCRIBE_KEY,
publishKey: PUBLISH_KEY,
subscribeKey: process.env.SUBSCRIBE_KEY || 'demo',
publishKey: process.env.PUBLISH_KEY || 'demo',
uuid: UUID,
cipherKey: 'abcdef',
});
Expand All @@ -44,8 +41,8 @@ describe('test', () => {

describe('without encryption', () => {
pubnub = new PubNub({
subscribeKey: SUBSCRIBE_KEY,
publishKey: PUBLISH_KEY,
subscribeKey: process.env.SUBSCRIBE_KEY || 'demo',
publishKey: process.env.PUBLISH_KEY || 'demo',
uuid: UUID,
});

Expand Down Expand Up @@ -166,7 +163,7 @@ describe('test', () => {
const result = await pubnub.sendFile({
channel: CHANNEL_1,
file: { data: testContent, name: 'someFile.txt', mimeType: 'text/plain' },
cipherKey: 'cipherKey'
cipherKey: 'cipherKey',
});

expect(result.name).to.equal('someFile.txt');
Expand All @@ -175,7 +172,7 @@ describe('test', () => {
channel: CHANNEL_1,
id: result.id,
name: result.name,
cipherKey: 'cipherKey'
cipherKey: 'cipherKey',
});

fileId = result.id;
Expand Down
10 changes: 5 additions & 5 deletions test/old_contract/world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ class PubnubWorld extends World {
subscribeKey: 'demo',
},
accessManagerKeyset: {
publishKey: process.env.PUBLISH_KEY_ACCESS || 'pub-key',
subscribeKey: process.env.SUBSCRIBE_KEY_ACCESS || 'sub-key',
secretKey: process.env.SECRET_KEY_ACCESS || 'secret-key',
publishKey: process.env.PAM_PUBLISH_KEY || 'pub-key',
subscribeKey: process.env.PAM_SUBSCRIBE_KEY || 'sub-key',
secretKey: process.env.PAM_SECRET_KEY || 'secret-key',
},
accessManagerWithoutSecretKeyKeyset: {
publishKey: process.env.PUBLISH_KEY_ACCESS || 'pub-key',
subscribeKey: process.env.SUBSCRIBE_KEY_ACCESS || 'sub-key',
publishKey: process.env.PAM_PUBLISH_KEY || 'pub-key',
subscribeKey: process.env.PAM_SUBSCRIBE_KEY || 'sub-key',
},
tokenWithKnownAuthorizedUUID:
'qEF2AkF0GmEI03xDdHRsGDxDcmVzpURjaGFuoWljaGFubmVsLTEY70NncnChb2NoYW5uZWxfZ3JvdXAtMQVDdXNyoENzcGOgRHV1aWShZnV1aWQtMRhoQ3BhdKVEY2hhbqFtXmNoYW5uZWwtXFMqJBjvQ2dycKF0XjpjaGFubmVsX2dyb3VwLVxTKiQFQ3VzcqBDc3BjoER1dWlkoWpedXVpZC1cUyokGGhEbWV0YaBEdXVpZHR0ZXN0LWF1dGhvcml6ZWQtdXVpZENzaWdYIPpU-vCe9rkpYs87YUrFNWkyNq8CVvmKwEjVinnDrJJc',
Expand Down

0 comments on commit 50ed4f7

Please sign in to comment.