Skip to content

Commit

Permalink
Merge pull request #75 from momentohq/fix/momento-api-key
Browse files Browse the repository at this point in the history
fix: rename TEST_API_KEY to MOMENTO_API_KEY
  • Loading branch information
rishtigupta authored Nov 13, 2024
2 parents 31a3af3 + 379a0e0 commit a840771
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
jvm:
runs-on: ubuntu-latest
env:
TEST_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
MOMENTO_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_CACHE_NAME: kotlin-integration-test-jvm-ci-${{ github.sha }}

steps:
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
matrix:
api-level: [ 26 ]
env:
TEST_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
MOMENTO_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_CACHE_NAME: kotlin-integration-test-android-ci-${{ github.sha }}

steps:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export PATH=$PATH:$ANDROID_HOME/platform-tools
## Testing
### Intellij
Android instrumented tests can be run by running them through IntelliJ with the Android plugin or Android Studio.
The `TEST_API_KEY` must be set in your `.zshrc` or somewhere else IntelliJ can read it when it executes the gradle project. The tests cannot directly read environment variables from the host machine, so `TEST_API_KEY` is read by the gradle project and stored in a test property.
The `MOMENTO_API_KEY` must be set in your `.zshrc` or somewhere else IntelliJ can read it when it executes the gradle project. The tests cannot directly read environment variables from the host machine, so `MOMENTO_API_KEY` is read by the gradle project and stored in a test property.

### Command Line
Android instrumented tests can be run from the command line by first starting an emulator:
Expand All @@ -23,4 +23,4 @@ Then run the tests:
```bash
./gradlew connectedAndroidTest
```
`TEST_API_KEY` must be set for the tests to work.
`MOMENTO_API_KEY` must be set for the tests to work.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2024 Momento Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ android {
defaultConfig {
minSdk = 23
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments["TestApiKey"] = System.getenv("TEST_API_KEY") ?: "noApiKeySet"
testInstrumentationRunnerArguments["MomentoApiKey"] = System.getenv("MOMENTO_API_KEY") ?: "noApiKeySet"
testInstrumentationRunnerArguments["TestCacheName"] = System.getenv("TEST_CACHE_NAME") ?: "test-android-cache"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ open class BaseAndroidTestClass {
// Instrumented Android tests cannot access environment variables directly, so we
// pass them in as arguments to the test runner. They are defined in build.gradle.kts.
val arguments = InstrumentationRegistry.getArguments()
val apiKey = arguments.getString("TestApiKey")!!
val apiKey = arguments.getString("MomentoApiKey")!!
cacheName = arguments.getString("TestCacheName")!!
credentialProvider = CredentialProvider.fromString(apiKey)
cacheClient = CacheClient(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ internal actual class InternalTopicClient actual constructor(
)
}
}
println("Received message: $message")
}.mapNotNull { message ->
convertSubscriptionItem(message)
}.collect { (topicMessage, sequenceNumber, sequencePage) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ open class BaseJvmTestClass {
@BeforeClass
fun createCacheClient() {
cacheClient = CacheClient(
credentialProvider = CredentialProvider.fromEnvVar("TEST_API_KEY"),
credentialProvider = CredentialProvider.fromEnvVar("MOMENTO_API_KEY"),
configuration = Configurations.Laptop.latest,
itemDefaultTtl = 60.seconds
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class TopicClientTest : BaseJvmTestClass() {
@BeforeClass
fun setUp() {
topicClient = TopicClient(
credentialProvider = CredentialProvider.fromEnvVar("TEST_API_KEY"),
credentialProvider = CredentialProvider.fromEnvVar("MOMENTO_API_KEY"),
configuration = TopicConfigurations.Laptop.latest
)
}
Expand Down

0 comments on commit a840771

Please sign in to comment.