Skip to content

Commit 2e9dbfa

Browse files
committed
use test script with spaces in the name for echoing the token json
1 parent ca523c1 commit 2e9dbfa

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/config_test.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -792,24 +792,16 @@ describe('KubeConfig', () => {
792792
}
793793
});
794794
it('should exec succesfully with spaces in cmd', async () => {
795-
/**
796-
*
797-
* to test this, symlink echo to dir that has spaces:
798-
* mkdir -p /tmp/foo\ bar/
799-
* ln -s /bin/echo /tmp/foo\ bar/echo
800-
*
801-
* FIXME: Figure out a "portable" way to dynamically do this sort of symlink as part of the test case
802-
*/
803795
const config = new KubeConfig();
804796
const token = 'token';
805797
const responseStr = `{"token":{"accessToken":"${token}"}}`;
806798
config.loadFromClusterAndUser(
807799
{ skipTLSVerify: false } as Cluster,
808800
{
809801
authProvider: {
810-
name: 'azure', // aplias to gcp too as they are both handled by CloudAuth class
802+
name: 'azure', // applies to gcp too as they are both handled by CloudAuth class
811803
config: {
812-
'cmd-path': '/tmp/foo bar/echo',
804+
'cmd-path': path.join(__dirname, '..', 'test', 'echo space.js'),
813805
'cmd-args': `'${responseStr}'`,
814806
'token-key': '{.token.accessToken}',
815807
'expiry-key': '{.token.token_expiry}',

test/echo space.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env node
2+
3+
// Just echo back all the args
4+
console.log(process.argv.slice(2).join(' '))

0 commit comments

Comments
 (0)