Skip to content

Instantly share code, notes, and snippets.

@sandromello
Last active July 2, 2025 12:40
Show Gist options
  • Select an option

  • Save sandromello/2d4a67d3addc451ba28d2ab2d3f4ba0f to your computer and use it in GitHub Desktop.

Select an option

Save sandromello/2d4a67d3addc451ba28d2ab2d3f4ba0f to your computer and use it in GitHub Desktop.

Revisions

  1. sandromello revised this gist Jul 2, 2025. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions test-mongo-script.md
    Original file line number Diff line number Diff line change
    @@ -77,4 +77,7 @@ hoop admin delete conn mongo2-test
    hoop admin delete conn mongo3-test
    hoop admin delete conn mongo4-test
    hoop admin delete conn mongo5-test

    hoop connect bash
    rm -f /tmp/mongo*
    ```
  2. sandromello revised this gist Jul 2, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion test-mongo-script.md
    Original file line number Diff line number Diff line change
    @@ -67,7 +67,7 @@ hoop admin create conn mongo5-test -a default --type database/mongodb \
    -- /tmp/mongo5 --quiet '$CONNECTION_STRING'
    ```

    - Test listing the table in the editor for each connection and see which one fails
    - Test listing the tables in the editor for each connection and see which one fails

    # Wipe Tests

  3. sandromello revised this gist Jul 2, 2025. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions test-mongo-script.md
    Original file line number Diff line number Diff line change
    @@ -67,6 +67,8 @@ hoop admin create conn mongo5-test -a default --type database/mongodb \
    -- /tmp/mongo5 --quiet '$CONNECTION_STRING'
    ```

    - Test listing the table in the editor for each connection and see which one fails

    # Wipe Tests

    ```sh
  4. sandromello created this gist Jul 2, 2025.
    78 changes: 78 additions & 0 deletions test-mongo-script.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,78 @@
    # Add test Mongo Scripts into the agent

    Open a bash session to the agent and add the following scripts to the `/tmp` folder

    ```sh
    hoop connect bash

    cat - > /tmp/mongo1 <<'EOF'
    #!/bin/bash
    set -eo pipefail
    MONGO_BIN=/usr/bin/mongo
    $MONGO_BIN $@
    EOF

    cat - > /tmp/mongo2 <<'EOF'
    #!/bin/bash
    set -eo pipefail
    /usr/bin/mongo $@
    EOF

    cat - > /tmp/mongo3 <<'EOF'
    #!/bin/bash
    /usr/bin/mongo $@
    EOF

    cat - > /tmp/mongo4 <<'EOF'
    #!/bin/bash
    /usr/bin/mongo "$@"
    EOF

    cat - > /tmp/mongo5 <<'EOF'
    #!/bin/bash
    MONGO_BIN=/usr/bin/mongo
    $MONGO_BIN "$@"
    EOF

    chmod +x /tmp/mongo*
    ```

    # Create test Connections for each script

    ```sh
    hoop admin create conn mongo1-test -a default --type database/mongodb \
    -e CONNECTION_STRING="" \
    -- /tmp/mongo1 --quiet '$CONNECTION_STRING'

    hoop admin create conn mongo2-test -a default --type database/mongodb \
    -e CONNECTION_STRING="" \
    -- /tmp/mongo2 --quiet '$CONNECTION_STRING'

    hoop admin create conn mongo3-test -a default --type database/mongodb \
    -e CONNECTION_STRING="" \
    -- /tmp/mongo3 --quiet '$CONNECTION_STRING'

    hoop admin create conn mongo4-test -a default --type database/mongodb \
    -e CONNECTION_STRING="" \
    -- /tmp/mongo4 --quiet '$CONNECTION_STRING'

    hoop admin create conn mongo5-test -a default --type database/mongodb \
    -e CONNECTION_STRING="" \
    -- /tmp/mongo5 --quiet '$CONNECTION_STRING'
    ```

    # Wipe Tests

    ```sh
    hoop admin delete conn mongo1-test
    hoop admin delete conn mongo2-test
    hoop admin delete conn mongo3-test
    hoop admin delete conn mongo4-test
    hoop admin delete conn mongo5-test
    ```