Skip to content

Commit

Permalink
chore: rename TEST_AUTH_TOKEN to TEST_API_KEY (#1217)
Browse files Browse the repository at this point in the history
  • Loading branch information
rishtigupta authored Apr 9, 2024
1 parent 1d87df1 commit 1c77b38
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
name: Test Cache on Node ${{ matrix.node }}
runs-on: macos-latest
env:
TEST_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_SESSION_TOKEN: ${{ secrets.MOMENTO_PREPROD_SESSION_TOKEN }}
TEST_LEGACY_AUTH_TOKEN: ${{ secrets.ALPHA_LEGACY_TEST_AUTH_TOKEN }}

Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
name: Test MVI on Node ${{ matrix.node }}
runs-on: macos-latest
env:
TEST_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_SESSION_TOKEN: ${{ secrets.MOMENTO_PREPROD_SESSION_TOKEN }}
TEST_LEGACY_AUTH_TOKEN: ${{ secrets.ALPHA_LEGACY_TEST_AUTH_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on-push-to-main-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
test:
runs-on: macos-latest
env:
TEST_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_SESSION_TOKEN: ${{ secrets.MOMENTO_PREPROD_SESSION_TOKEN }}
TEST_LEGACY_AUTH_TOKEN: ${{ secrets.ALPHA_LEGACY_TEST_AUTH_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on-push-to-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
# The type of runner that the job will run on
runs-on: macos-latest
env:
TEST_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_SESSION_TOKEN: ${{ secrets.MOMENTO_PREPROD_SESSION_TOKEN }}
TEST_LEGACY_AUTH_TOKEN: ${{ secrets.ALPHA_LEGACY_TEST_AUTH_TOKEN }}
needs: release
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ Most packages.json files have script targets like `unit-test` and `integration-t
For example, you will probably need to limit Jest `maxWorkers` to avoid throttling errors due to concurrency, and you will want to skip the auth tests unless you have a session token, etc. So here is an example command you might use to run all the integration tests other than the auth tests:

```
TEST_AUTH_TOKEN=<your_token_here> npx jest integration --maxWorkers 1 --testPathIgnorePatterns auth-client-test.ts
TEST_API_KEY=<your_api_key_here> npx jest integration --maxWorkers 1 --testPathIgnorePatterns auth-client-test.ts
```

Or, if you only want to run the dictionary tests:

```
TEST_AUTH_TOKEN=<your_token_here> npx jest dictionary
TEST_API_KEY=<your_api_key_here> npx jest dictionary
```

**NOTE**: if you make changes in the `core` or `common-integration-tests` packages, you will need to build your changes before the SDK packages can pick them up. You can do this via `npm run build` in the shared package directory, or `./scripts/build-all-packages.sh` from the root dir.
Expand All @@ -72,7 +72,7 @@ TEST_AUTH_TOKEN=<your_token_here> npx jest dictionary
In either the `client-sdk-nodejs` or `client-sdk-web` directories:

```
export TEST_AUTH_TOKEN=<YOUR_AUTH_TOKEN>
export TEST_API_KEY=<YOUR_API_KEY>
export TEST_SESSION_TOKEN=<YOUR_SESSION_TOKEN>
npm run integration-test-auth
```
Expand All @@ -84,7 +84,7 @@ will hit Momento throttling limits. To limit the concurrency to ensure you don'
you can use jest's `--maxWorkers` flag:

```
export TEST_AUTH_TOKEN=<YOUR_AUTH_TOKEN>
export TEST_API_KEY=<YOUR_API_KEY>
npx jest --maxWorkers 1
```

Expand All @@ -98,7 +98,7 @@ to jest in order to limit the set of tests that you want to run.
e.g. to re-build and run the integration tests, and filter to only the dictionary tests:

```
export TEST_AUTH_TOKEN=<YOUR_AUTH_TOKEN>
export TEST_API_KEY=<YOUR_API_KEY>
npm run build-and-run-tests -- dictionary
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ let _credsProvider: CredentialProvider | undefined = undefined;
export function credsProvider(): CredentialProvider {
if (_credsProvider === undefined) {
_credsProvider = CredentialProvider.fromEnvironmentVariable({
environmentVariableName: 'TEST_AUTH_TOKEN',
environmentVariableName: 'TEST_API_KEY',
});
}
return _credsProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ describe('default configurations', () => {
it('CacheClient should be able to be constructed with a simple string for env var', () => {
const cacheClientViaConstructor = new CacheClient({
credentialProvider:
CredentialProvider.fromEnvironmentVariable('TEST_AUTH_TOKEN'),
CredentialProvider.fromEnvironmentVariable('TEST_API_KEY'),
defaultTtlSeconds: 60,
});
expect(cacheClientViaConstructor).toBeInstanceOf(CacheClient);
});

it('CacheClient should be able to be constructed with a simple string for env var, using short function name', () => {
const cacheClientViaConstructor = new CacheClient({
credentialProvider: CredentialProvider.fromEnvVar('TEST_AUTH_TOKEN'),
credentialProvider: CredentialProvider.fromEnvVar('TEST_API_KEY'),
defaultTtlSeconds: 60,
});
expect(cacheClientViaConstructor).toBeInstanceOf(CacheClient);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ let _credsProvider: CredentialProvider | undefined = undefined;
export function credsProvider(): CredentialProvider {
if (_credsProvider === undefined) {
_credsProvider = CredentialProvider.fromEnvironmentVariable({
environmentVariableName: 'TEST_AUTH_TOKEN',
environmentVariableName: 'TEST_API_KEY',
});
}
return _credsProvider;
Expand Down
2 changes: 1 addition & 1 deletion packages/client-sdk-nodejs/test/unit/cache-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('CacheClient', () => {
const momento = await CacheClient.create({
configuration: configuration,
credentialProvider: CredentialProvider.fromEnvironmentVariable({
environmentVariableName: 'TEST_AUTH_TOKEN',
environmentVariableName: 'TEST_API_KEY',
}),
defaultTtlSeconds: 100,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ describe('default configurations', () => {
it('CacheClient should be able to be constructed with a simple string for env var', () => {
const cacheClientViaConstructor = new CacheClient({
credentialProvider:
CredentialProvider.fromEnvironmentVariable('TEST_AUTH_TOKEN'),
CredentialProvider.fromEnvironmentVariable('TEST_API_KEY'),
defaultTtlSeconds: 60,
});
expect(cacheClientViaConstructor).toBeInstanceOf(CacheClient);
});

it('CacheClient should be able to be constructed with a simple string for env var, using short function name', () => {
const cacheClientViaConstructor = new CacheClient({
credentialProvider: CredentialProvider.fromEnvVar('TEST_AUTH_TOKEN'),
credentialProvider: CredentialProvider.fromEnvVar('TEST_API_KEY'),
defaultTtlSeconds: 60,
});
expect(cacheClientViaConstructor).toBeInstanceOf(CacheClient);
Expand Down
4 changes: 2 additions & 2 deletions packages/client-sdk-web/test/integration/integration-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function credsProvider(): CredentialProvider {
if (_credsProvider === undefined) {
if (isLocalhostDevelopmentMode()) {
_credsProvider = CredentialProvider.fromEnvironmentVariable({
environmentVariableName: 'TEST_AUTH_TOKEN',
environmentVariableName: 'TEST_API_KEY',
endpointOverrides: {
controlEndpoint: 'https://no-controlplane-requests-allowed:9001',
cacheEndpoint: 'https://localhost:9001',
Expand All @@ -42,7 +42,7 @@ export function credsProvider(): CredentialProvider {
});
} else {
_credsProvider = CredentialProvider.fromEnvironmentVariable({
environmentVariableName: 'TEST_AUTH_TOKEN',
environmentVariableName: 'TEST_API_KEY',
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('ping service', () => {
const cacheClientProps: CacheClientProps = {
configuration: Configurations.Laptop.latest(),
credentialProvider: CredentialProvider.fromEnvironmentVariable({
environmentVariableName: 'TEST_AUTH_TOKEN',
environmentVariableName: 'TEST_API_KEY',
}),
defaultTtlSeconds: 1111,
};
Expand Down
10 changes: 5 additions & 5 deletions packages/core/test/unit/auth/credential-provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ describe('EnvMomentoTokenProvider', () => {
});

it('parses a valid legacy token', () => {
const testEnvVarName = 'TEST_AUTH_TOKEN_ENV_VAR';
const testEnvVarName = 'TEST_API_KEY_ENV_VAR';
process.env[testEnvVarName] = fakeTestLegacyToken;
const authProvider = CredentialProvider.fromEnvironmentVariable({
environmentVariableName: testEnvVarName,
Expand All @@ -161,7 +161,7 @@ describe('EnvMomentoTokenProvider', () => {
});

it('parses a valid v1 auth token', () => {
const testEnvVarName = 'TEST_AUTH_TOKEN_ENV_VAR';
const testEnvVarName = 'TEST_API_KEY_ENV_VAR';
process.env[testEnvVarName] = base64EncodedFakeV1AuthToken;
const authProvider = CredentialProvider.fromEnvironmentVariable({
environmentVariableName: testEnvVarName,
Expand All @@ -176,7 +176,7 @@ describe('EnvMomentoTokenProvider', () => {
});

it('supports overriding endpoints via base endpoint', () => {
const testEnvVarName = 'TEST_AUTH_TOKEN_ENV_VAR';
const testEnvVarName = 'TEST_API_KEY_ENV_VAR';
process.env[testEnvVarName] = fakeTestLegacyToken;
const authProvider = CredentialProvider.fromEnvironmentVariable({
environmentVariableName: testEnvVarName,
Expand Down Expand Up @@ -207,7 +207,7 @@ describe('EnvMomentoTokenProvider', () => {
});

it('supports overriding all endpoints explicitly', () => {
const testEnvVarName = 'TEST_AUTH_TOKEN_ENV_VAR';
const testEnvVarName = 'TEST_API_KEY_ENV_VAR';
process.env[testEnvVarName] = fakeTestLegacyToken;
const legacyAuthProvider = CredentialProvider.fromEnvironmentVariable({
environmentVariableName: testEnvVarName,
Expand Down Expand Up @@ -244,7 +244,7 @@ describe('EnvMomentoTokenProvider', () => {
});

it('supports adding a prefix to baseEndpoint derived endpoints', () => {
const testEnvVarName = 'TEST_AUTH_TOKEN_ENV_VAR';
const testEnvVarName = 'TEST_API_KEY_ENV_VAR';
process.env[testEnvVarName] = fakeTestLegacyToken;
const legacyAuthProvider = CredentialProvider.fromEnvironmentVariable({
environmentVariableName: testEnvVarName,
Expand Down

0 comments on commit 1c77b38

Please sign in to comment.