Skip to content
Permalink
Browse files

Fix - Resize and backups Tests (#128)

* Update resize with new param

* Fix backup snapshot assertion

* Add timestamp buster
  • Loading branch information...
patthiel committed Jun 21, 2019
1 parent 57aee2d commit 623a16f1557b9f800f612f32df87bc4ec7611963
Showing with 23 additions and 25 deletions.
  1. +1 −1 test/domains/domain-records.bats
  2. +6 −6 test/domains/master-domains.bats
  3. +10 −10 test/linodes/backups.bats
  4. +6 −8 test/linodes/resize.bats
@@ -21,7 +21,7 @@ teardown() {

run linode-cli domains create \
--type master \
--domain "$timestamp-example.com" \
--domain "A$timestamp-example.com" \
--soa_email="pthiel@linode.com" \
--text \
--no-header
@@ -20,7 +20,7 @@ teardown() {

@test "it should fail to create a domain without specifying a type" {
run linode-cli domains create \
--domain "$timestamp-example.com" \
--domain "BC$timestamp-example.com" \
--soa_email="pthiel+$timestamp@linode.com" \
--text \
--no-header
@@ -33,7 +33,7 @@ teardown() {
@test "it should fail to create a master domain without a SOA email" {
run linode-cli domains create \
--type master \
--domain "$timestamp-example.com" \
--domain "BC$timestamp-example.com" \
--text \
--no-header

@@ -46,14 +46,14 @@ teardown() {
run linode-cli domains create \
--type master \
--soa_email="pthiel+$timestamp@linode.com" \
--domain "$timestamp-example.com" \
--domain "BC$timestamp-example.com" \
--text \
--no-header \
--delimiter "," \
--format="id,domain,type,status,soa_email"

assert_success
assert_output --regexp "[0-9]+,$timestamp-example.com,master,active,pthiel\+$timestamp@linode.com"
assert_output --regexp "[0-9]+,BC$timestamp-example.com,master,active,pthiel\+$timestamp@linode.com"
}

@test "it should update the master domain soa_email" {
@@ -80,7 +80,7 @@ teardown() {
--delimiter=","

assert_success
assert_output --regexp "[0-9]+,[0-9]+-example.com,master,active"
assert_output --regexp "[0-9]+,BC[0-9]+-example.com,master,active"
}

@test "it should show domain detail" {
@@ -91,7 +91,7 @@ teardown() {
--format="id,domain,type,status,soa_email"

assert_success
assert_output --regexp "[0-9]+,[0-9]+-example.com,master,active"
assert_output --regexp "[0-9]+,BC[0-9]+-example.com,master,active"
}

@test "it should delete all master domains" {
@@ -13,15 +13,15 @@ setup() {
suiteName="backups"
setToken "$suiteName"
export timestamp=$(date +%s)
clean_linodes="false"
clean_linodes="FALSE"
linode_id=$(linode-cli linodes list --format id --text --no-header | head -n 1)
snapshot_label="test_snapshot1"
}

teardown() {
unset timestamp

if [ "$clean_linodes" = "true" ] || [ "$last_test" = "true" ]; then
if [ "$clean_linodes" = "TRUE" ] || [ "$LAST_TEST" = "TRUE" ]; then
run removeLinodes
fi

@@ -65,7 +65,7 @@ teardown() {
assert_output --partial "$linode_id,True"

# Cleanup linodes
clean_linodes="true"
clean_linodes="TRUE"
}

@test "it should create a backup with backups enabled" {
@@ -131,12 +131,12 @@ teardown() {

# assert_output --regexp "[0-9]+,pending,snapshot,[0-9]+-[0-9]+-[0-9]+T[0-9]+:[0-9]+:[0-9]+,${snapshot_label}"
# BUG outputs the backup as json, assertion below asserts that outputs the expected.
assert_output --regexp "\'status\': \'pending."
assert_output --regexp "\'finished\': None"
assert_output --regexp "\'type\': \'snapshot\'"
assert_output --regexp "\'label\': \'$snapshot_label\'"
assert_output --regexp "\'region\': \'us-east\'"
assert_output --regexp "\'id\': [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"
assert_output --regexp "'status':.*'pending"
assert_output --regexp "'finished':.*None"
assert_output --regexp "'type':.*'snapshot'"
assert_output --regexp "'label':.*'$snapshot_label'"
assert_output --regexp "'region':.*'us-east'"
assert_output --regexp "'id':.*[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"
else
skip "Skipping long-running Test, to run set RUN_LONG_TESTS=TRUE"
fi
@@ -159,5 +159,5 @@ teardown() {
--no-headers
assert_success

clean_linodes="true"
clean_linodes="TRUE"
}
@@ -13,19 +13,19 @@ setup() {
suiteName="resize"
setToken "$suiteName"
export timestamp=$(date +%s)
plan=$(linode-cli linodes types --format="id" --text --no-headers | sed -n 2p)
}

teardown() {
unset timestamp
run removeLinodes

if [ "$LAST_TEST" = "TRUE" ]; then
run removeLinodes
clearToken "$suiteName"
fi
}

@test "it should fail to resize to the same plan" {
local plan=$(linode-cli linodes types --format="id" --text --no-headers | sed -n 2p)
run createLinodeAndWait $test_image $plan
linode_id=$(linode-cli linodes list --format id --text --no-header | head -n 1)
linode_plan=$(linode-cli linodes view $linode_id --format="type" --text --no-headers)
@@ -44,9 +44,6 @@ teardown() {

@test "it should fail to resize to a smaller plan" {
smaller_plan=$(linode-cli linodes types --format="id" --text --no-headers | sed -n 1p)
local plan=$(linode-cli linodes types --format="id" --text --no-headers | sed -n 2p)

run createLinodeAndWait $test_image $plan
linode_id=$(linode-cli linodes list --format id --text --no-header | head -n 1)

run linode-cli linodes resize \
@@ -61,10 +58,8 @@ teardown() {
}

@test "it should fail to resize to an invalid plan" {
local plan=$(linode-cli linodes types --format="id" --text --no-headers | sed -n 2p)
run createLinodeAndWait $test_image $plan
invalid_plan="g15-bad-plan"
linode_id=$(linode-cli linodes list --format id --text --no-header | head -n 1)
invalid_plan="g15-bad-plan"

run linode-cli linodes resize \
--type=$invalid_plan \
@@ -81,7 +76,10 @@ teardown() {
LAST_TEST="TRUE"
if [ $RUN_LONG_TESTS = "TRUE" ]; then
larger_plan=$(linode-cli linodes types --format="id" --text --no-headers | sed -n 3p)
linode_id=$(linode-cli linodes list --format id --text --no-header | head -n 1)

run linode-cli linodes resize \
--allow_auto_disk_resize=true \
--type=$larger_plan \
--text \
--no-headers \

0 comments on commit 623a16f

Please sign in to comment.
You can’t perform that action at this time.