TheJumpCloud / support

Public scripts and examples for managing JumpCloud managed systems and service endpoints
267 stars 154 forks source link

Error running jumpcloud test script #17

Closed hongkongkiwi closed 6 years ago

hongkongkiwi commented 6 years ago

When running the JumpCloud test script I get: line 195: continue: only meaningful in afor', while', oruntil' loop`

This happens right after I enter the organisational ID in the credentials setup.

scottd3v commented 6 years ago

Hey! Looking at line 195:

   It "Ensures the warning message is displayed by default, Deletes a single JumpCloud command result declaring -CommandResultIT" {
        $SingleCommandResult = Get-JCCommandResult | Select-Object -Last 1
        $DeletedResult = Remove-JCCommandResult -CommandResultID $SingleCommandResult._id
        $DeletedResult._id.count | Should -Be 1
    }

This test is ensuring that there is a promp shown when deleing a command.

Before you can run the tests you must install Pester and also set up a test org that meets all the testing criteria.

After this org is set up you then populate the variables in the top of the .tests.ps1 file.

Have you completed these steps?

flybyray commented 2 years ago

@scottd3v the answesers are just non-sense

The script mentioned is https://github.com/TheJumpCloud/support/blob/master/scripts/jumpcloud_test_utility.sh which is linked from various knowledge base articles. The error is bash context error. The exact line is now here

https://github.com/TheJumpCloud/support/blob/master/scripts/jumpcloud_test_utility.sh#L215

You can run it with bash -x ... to have a more clear understanding what happens here:

+ cat
###########################
####    Main Menu     #####
###########################

1. Enter LDAP account variables
2. Set LDAP port 389 (STARTTLS)
3. Set LDAP port 636 (SSL)
4. LDAP Search Menu
5. Display Common LDAP settings
6. API access
9. Help
0. Exit
+ read_main_menu
+ echo -ne '\nSelect an option: '

Select an option: + read option
1
+ case $option in
+ read_account
+ read_user
+ echo -n 'Enter LDAP Binding User account name: '
Enter LDAP Binding User account name: + read user
typed_user
+ '[' -z typed_user ']'
+ read_pass
+ echo -n 'Enter password: '
Enter password: + read -s pass
+ echo

+ '[' -z typed_password ']'
+ read_oid
+ echo -n 'Enter the organization ID: '
Enter the organization ID: + read oid
typed_orgid
+ '[' -z typed_orgid ']'
+ continue
./jumpcloud_test_utility.sh: line 215: continue: only meaningful in a `for', `while', or `until' loop
+ read_pass
+ echo -n 'Enter password: '

"Thanks for looking so deep into this one."