-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: move ping functionality into cache client (#516)
* chore: move ping functionality into cache client * fix: fix test typo * fix: simplify calculation of ping client endpoint
- Loading branch information
1 parent
d7b7945
commit 4b2f77d
Showing
11 changed files
with
72 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,38 @@ | ||
import {PingClient} from '../../src/ping-client'; | ||
import {NoopMomentoLoggerFactory} from '@gomomento/sdk-core'; | ||
import { | ||
CredentialProvider, | ||
MomentoLoggerFactory, | ||
NoopMomentoLoggerFactory, | ||
} from '@gomomento/sdk-core'; | ||
import {CacheClient} from '../../src'; | ||
import {PingClient} from '../../src/internal/ping-client'; | ||
import {expectWithMessage} from '@gomomento/common-integration-tests'; | ||
|
||
describe('ping service', () => { | ||
it('ping should work', async () => { | ||
const client = new PingClient({ | ||
endpoint: 'cell-alpha-dev.preprod.a.momentohq.com', | ||
const cacheClient = new CacheClient({ | ||
credentialProvider: CredentialProvider.fromEnvironmentVariable({ | ||
environmentVariableName: 'TEST_AUTH_TOKEN', | ||
}), | ||
}); | ||
await cacheClient.ping(); | ||
}); | ||
it('should fail on bad URL', async () => { | ||
const pingClient = new PingClient({ | ||
endpoint: 'bad.url', | ||
configuration: { | ||
getLoggerFactory: () => new NoopMomentoLoggerFactory(), | ||
getLoggerFactory(): MomentoLoggerFactory { | ||
return new NoopMomentoLoggerFactory(); | ||
}, | ||
}, | ||
}); | ||
await client.ping(); | ||
try { | ||
await pingClient.ping(); | ||
// we shouldn't get to the assertion below | ||
expect(true).toBeFalse(); | ||
} catch (error) { | ||
expectWithMessage(() => { | ||
expect((error as Error).name).toEqual('RpcError'); | ||
}, `expected RpcError but got ${(error as Error).toString()}`); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
export * from './ping'; | ||
export * from './cache'; | ||
export * from './auth'; | ||
export * from './pubsub'; |
33 changes: 0 additions & 33 deletions
33
packages/core/src/internal/clients/ping/AbstractPingClient.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.