Skip to content

Commit

Permalink
Merge branch 'linode:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
zliang-akamai authored Nov 7, 2023
2 parents e3a1ee4 + fcbc407 commit aac3856
Show file tree
Hide file tree
Showing 25 changed files with 235 additions and 251 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/e2e-suite-pr-command.yml

This file was deleted.

9 changes: 7 additions & 2 deletions linodecli/plugins/obj/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
from pathlib import Path
from typing import List

from boto3.exceptions import S3UploadFailedError
from boto3.s3.transfer import MB, TransferConfig
try:
from boto3.exceptions import S3UploadFailedError
from boto3.s3.transfer import MB, TransferConfig
except:
# this has been handled in `call` function
# by print an error message
pass

from linodecli.helpers import expand_globs
from linodecli.plugins import inherit_plugin_args
Expand Down
28 changes: 14 additions & 14 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ def _generate_test_files(

# test helper specific to Domains test suite
@pytest.fixture
def create_master_domain():
timestamp = str(int(time.time()))
def master_domain():
timestamp = str(time.time_ns())

domain_id = (
exec_test_command(
Expand Down Expand Up @@ -152,8 +152,8 @@ def create_master_domain():


@pytest.fixture
def create_slave_domain():
timestamp = str(int(time.time()) + randint(10, 1000))
def slave_domain():
timestamp = str(time.time_ns())

domain_id = (
exec_test_command(
Expand Down Expand Up @@ -184,16 +184,16 @@ def create_slave_domain():

# Test helpers specific to Linodes test suite
@pytest.fixture
def create_linode_with_label():
timestamp = str(int(time.time()) + randint(10, 1000))
def linode_with_label():
timestamp = str(time.time_ns())
label = "cli" + timestamp
result = (
exec_test_command(
LINODE_BASE_CMD
+ [
"create",
"--type",
"g6-standard-2",
"g6-nanode-1",
"--region",
"us-east",
"--image",
Expand Down Expand Up @@ -223,14 +223,14 @@ def create_linode_with_label():


@pytest.fixture
def create_linode_min_req():
def linode_min_req():
result = (
exec_test_command(
LINODE_BASE_CMD
+ [
"create",
"--type",
"g6-standard-2",
"g6-nanode-1",
"--region",
"us-east",
"--root_pass",
Expand All @@ -256,7 +256,7 @@ def create_linode_min_req():


@pytest.fixture
def create_linode_wo_image():
def linode_wo_image():
label = "cli" + str(int(time.time()) + randint(10, 1000))
linode_id = (
exec_test_command(
Expand Down Expand Up @@ -288,7 +288,7 @@ def create_linode_wo_image():


@pytest.fixture
def create_linode_backup_enabled():
def linode_backup_enabled():
# create linode with backups enabled
linode_id = (
exec_test_command(
Expand Down Expand Up @@ -321,8 +321,8 @@ def create_linode_backup_enabled():


@pytest.fixture
def take_snapshot_of_linode():
timestamp = str(time.time())
def snapshot_of_linode():
timestamp = str(time.time_ns())
# get linode id after creation and wait for "running" status
linode_id = create_linode_and_wait()
new_snapshot_label = "test_snapshot" + timestamp
Expand All @@ -348,7 +348,7 @@ def take_snapshot_of_linode():

# Test helpers specific to Nodebalancers test suite
@pytest.fixture
def create_nodebalancer_with_default_conf():
def nodebalancer_with_default_conf():
result = (
exec_test_command(
NODEBALANCER_BASE_CMD
Expand Down
34 changes: 17 additions & 17 deletions tests/integration/domains/test_domain_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@


@pytest.fixture
def domain_records_setup():
timestamp = str(int(time.time()))
def test_domain_and_record():
timestamp = str(time.time_ns())
# Create domain
domain_id = (
exec_test_command(
Expand Down Expand Up @@ -65,15 +65,15 @@ def domain_records_setup():


@pytest.mark.smoke
def test_create_a_domain(create_master_domain):
def test_create_a_domain(master_domain):
# Current domain list
process = exec_test_command(
BASE_CMD + ["list", '--format="id"', "--text", "--no-header"]
)
output_current = process.stdout.decode()

# Create domain
domain_id = create_master_domain
domain_id = master_domain

process = exec_test_command(
BASE_CMD + ["list", "--format=id", "--text", "--no-header"]
Expand All @@ -88,8 +88,8 @@ def test_create_a_domain(create_master_domain):


@pytest.mark.smoke
def test_create_domain_srv_record(domain_records_setup):
domain_id = domain_records_setup[0]
def test_create_domain_srv_record(test_domain_and_record):
domain_id = test_domain_and_record[0]

process = exec_test_command(
BASE_CMD
Expand Down Expand Up @@ -117,8 +117,8 @@ def test_create_domain_srv_record(domain_records_setup):
)


def test_list_srv_record(domain_records_setup):
domain_id = domain_records_setup[0]
def test_list_srv_record(test_domain_and_record):
domain_id = test_domain_and_record[0]
process = exec_test_command(
BASE_CMD
+ [
Expand All @@ -138,9 +138,9 @@ def test_list_srv_record(domain_records_setup):


@pytest.mark.smoke
def test_view_domain_record(domain_records_setup):
domain_id = domain_records_setup[0]
record_id = domain_records_setup[1]
def test_view_domain_record(test_domain_and_record):
domain_id = test_domain_and_record[0]
record_id = test_domain_and_record[1]

process = exec_test_command(
BASE_CMD
Expand All @@ -161,9 +161,9 @@ def test_view_domain_record(domain_records_setup):
)


def test_update_domain_record(domain_records_setup):
domain_id = domain_records_setup[0]
record_id = domain_records_setup[1]
def test_update_domain_record(test_domain_and_record):
domain_id = test_domain_and_record[0]
record_id = test_domain_and_record[1]

process = exec_test_command(
BASE_CMD
Expand All @@ -185,9 +185,9 @@ def test_update_domain_record(domain_records_setup):
)


def test_delete_a_domain_record(domain_records_setup):
domain_id = domain_records_setup[0]
record_id = domain_records_setup[1]
def test_delete_a_domain_record(test_domain_and_record):
domain_id = test_domain_and_record[0]
record_id = test_domain_and_record[1]

process = exec_test_command(
BASE_CMD + ["records-delete", domain_id, record_id]
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/domains/test_domains_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# @pytest.mark.skip(reason="BUG 943")
def test_fail_to_create_master_domain_with_invalid_tags():
timestamp = str(int(time.time()))
timestamp = str(time.time_ns())
bad_tag = "*"

exec_failing_test_command(
Expand All @@ -38,7 +38,7 @@ def test_fail_to_create_master_domain_with_invalid_tags():

# @pytest.mark.skip(reason="BUG 943")
def test_fail_to_create_slave_domain_with_invalid_tags():
timestamp = str(int(time.time()))
timestamp = str(time.time_ns())
bad_tag = "*"

exec_failing_test_command(
Expand All @@ -61,7 +61,7 @@ def test_fail_to_create_slave_domain_with_invalid_tags():

@pytest.mark.smoke
def test_create_master_domain_with_tags():
timestamp = str(int(time.time()))
timestamp = str(time.time_ns())
tag = "foo"

process = exec_test_command(
Expand Down
22 changes: 11 additions & 11 deletions tests/integration/domains/test_master_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@


@pytest.fixture
def setup_master_domains():
timestamp = str(int(time.time()))
def master_test_domain():
timestamp = str(time.time_ns())
# Create domain
master_domain_id = (
exec_test_command(
Expand Down Expand Up @@ -43,7 +43,7 @@ def setup_master_domains():


def test_create_domain_fails_without_spcified_type():
timestamp = str(int(time.time()))
timestamp = str(time.time_ns())

# get debug output from linode-cli to a temporary file..
# not all output from the linode-cli goes to stdout, stderr
Expand All @@ -66,7 +66,7 @@ def test_create_domain_fails_without_spcified_type():


def test_create_master_domain_fails_without_soa_email():
timestamp = str(int(time.time()))
timestamp = str(time.time_ns())
result = exec_failing_test_command(
BASE_CMD
+ [
Expand All @@ -85,17 +85,17 @@ def test_create_master_domain_fails_without_soa_email():


@pytest.mark.smoke
def test_create_master_domain(create_master_domain):
domain_id = create_master_domain
def test_create_master_domain(master_domain):
domain_id = master_domain
assert re.search("[0-9]+", domain_id)


def test_update_master_domain_soa_email(setup_master_domains):
def test_update_master_domain_soa_email(master_test_domain):
# Remove --master_ips param when 872 is resolved
timestamp = str(int(time.time()))
timestamp = str(time.time_ns())
new_soa_email = "[email protected]"

domain_id = setup_master_domains
domain_id = master_test_domain

result = exec_test_command(
BASE_CMD
Expand All @@ -117,7 +117,7 @@ def test_update_master_domain_soa_email(setup_master_domains):
assert new_soa_email in result


def test_list_master_domain(setup_master_domains):
def test_list_master_domain(master_test_domain):
result = exec_test_command(
BASE_CMD
+ [
Expand All @@ -133,7 +133,7 @@ def test_list_master_domain(setup_master_domains):
assert re.search("[0-9]+,BC[0-9]+-example.com,master,active", result)


def test_show_domain_detail(setup_master_domains):
def test_show_domain_detail(master_test_domain):
result = exec_test_command(
BASE_CMD
+ [
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/domains/test_slave_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
)

BASE_CMD = ["linode-cli", "domains"]
timestamp = str(int(time.time()))
timestamp = str(time.time_ns())


@pytest.fixture
Expand Down Expand Up @@ -61,12 +61,12 @@ def test_create_slave_domain_fails_without_master_dns_server():


@pytest.mark.smoke
def test_create_slave_domain(create_slave_domain):
domain_id = create_slave_domain
def test_create_slave_domain(slave_domain):
domain_id = slave_domain
assert re.search("[0-9]+", domain_id)


def test_list_slave_domain(create_slave_domain):
def test_list_slave_domain(slave_domain):
result = exec_test_command(
BASE_CMD + ["list", "--text", "--no-header"]
).stdout.decode()
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/events/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@


@pytest.fixture
def events_setup():
timestamp = str(int(time.time()))
def events_test_domain_id():
timestamp = str(time.time_ns())
# Create domain
domain_id = (
exec_test_command(
Expand Down Expand Up @@ -185,8 +185,8 @@ def test_filter_events_by_entity_id():


@pytest.mark.skip(reason="https://github.com/linode/linode-cli/issues/500")
def test_create_domain_and_filter_domain_events(events_setup):
domain_id = events_setup
def test_create_domain_and_filter_domain_events(events_test_domain_id):
domain_id = events_test_domain_id
result = exec_test_command(
BASE_CMD
+ [
Expand Down
Loading

0 comments on commit aac3856

Please sign in to comment.