Skip to content

Commit

Permalink
use test script with spaces in the name for echoing the token json
Browse files Browse the repository at this point in the history
  • Loading branch information
jnummelin committed Oct 11, 2019
1 parent ca523c1 commit 2e9dbfa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/config_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,24 +792,16 @@ describe('KubeConfig', () => {
}
});
it('should exec succesfully with spaces in cmd', async () => {
/**
*
* to test this, symlink echo to dir that has spaces:
* mkdir -p /tmp/foo\ bar/
* ln -s /bin/echo /tmp/foo\ bar/echo
*
* FIXME: Figure out a "portable" way to dynamically do this sort of symlink as part of the test case
*/
const config = new KubeConfig();
const token = 'token';
const responseStr = `{"token":{"accessToken":"${token}"}}`;
config.loadFromClusterAndUser(
{ skipTLSVerify: false } as Cluster,
{
authProvider: {
name: 'azure', // aplias to gcp too as they are both handled by CloudAuth class
name: 'azure', // applies to gcp too as they are both handled by CloudAuth class
config: {
'cmd-path': '/tmp/foo bar/echo',
'cmd-path': path.join(__dirname, '..', 'test', 'echo space.js'),
'cmd-args': `'${responseStr}'`,
'token-key': '{.token.accessToken}',
'expiry-key': '{.token.token_expiry}',
Expand Down
4 changes: 4 additions & 0 deletions test/echo space.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node

// Just echo back all the args
console.log(process.argv.slice(2).join(' '))

0 comments on commit 2e9dbfa

Please sign in to comment.