Skip to content

Commit

Permalink
chore(ci): test discover_public_ip does not unset var
Browse files Browse the repository at this point in the history
  • Loading branch information
emosbaugh committed Nov 8, 2024
1 parent 0370263 commit fa20f0b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scripts/common/test/discover-test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/bash

set -e

# shellcheck source=../common.sh
. ./scripts/common/common.sh
# shellcheck source=../discover.sh
. ./scripts/common/discover.sh

test_discover_public_ip()
Expand All @@ -25,6 +29,19 @@ test_discover_public_ip()
PUBLIC_ADDRESS=
discover_public_ip
assertEquals "" "$PUBLIC_ADDRESS"

# should not unset the public address if it is already set
ip_address=
PUBLIC_ADDRESS=34.28.226.7
discover_public_ip
assertEquals "34.28.226.7" "$PUBLIC_ADDRESS"

# should overwrite the public address if it is already set
ip_address=172.31.28.36
PUBLIC_ADDRESS=34.28.226.7
discover_public_ip
assertEquals "34.28.226.7" "$PUBLIC_ADDRESS"
}

# shellcheck disable=SC1091
. shunit2

0 comments on commit fa20f0b

Please sign in to comment.