Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Allow users to set environment variable to connect to emulator r…
…unning on docker (#1164) * Check if DATASTORE_EMULATOR_HOST is set Instead of checking to see if the endpoint is local, we should check to see if the datastore emulator variable is set. This is because there is an edge case where the user is using an emulator, but the emulator is not listening from local host and in this case we want to use insecure credentials. * Add tests for combinations of emulator / custom Add unit tests for evaluating value of ssl credentials. Tests evaluate what happens when the user uses remote custom endpoints or local custom endpoints in combination with different values for the DATASTORE_EMULATOR_HOST variable. * Revert "Check if DATASTORE_EMULATOR_HOST is set" This reverts commit dea1706. * Revert "Revert "Check if DATASTORE_EMULATOR_HOST is set"" This reverts commit a3b50df. * Clean up the tests The tests should use a concise apiEndpoint variable and they should set the host for the remote case to be the same as the apiEndpoint variable. * Add more test cases describing all behaviour More test cases are needed to describe what happens when the DATASTORE_EMULATOR_HOST variable is not set both in a remote and in a localhost environment because those behaviors should be different. Setting the apiEndpoint to localhost means the user wants to use the emulator without specifying the environment variable so insecure credentials should be provided. Setting the apiEndpoint to remote means the user likely wishes to use regional endpoints so should not be using insecure credentials to skip authentication. * Allows test cases to pass from previous commit If the user uses localhost as the endpoint or they provide DATASTORE_EMULATOR_HOST then it is assumed that the user is using the emulator and authentication is skipped. Otherwise, authentication is not skipped. * Change old test title back to the way it was The old test title should be what it was before. setHost is now only needed in one place. * Add comments to each test The comments need to be added to explain why the test is written the way that it is written so that we know the motivation behind each test.
- Loading branch information