-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eg: ``` β― ec2 describe -c Name,Volumes Name Volumes βββββββββββββββββββββββββββββββββββββββ the-fresh-instance ['Size=140 GiB'] ```
- Loading branch information
Showing
6 changed files
with
108 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,15 +177,6 @@ def test_describe_instance_without_tags(mock_aws_config: Config): | |
assert len(instances) == 1 | ||
|
||
|
||
def test_tag(mock_aws_config: Config): | ||
launch(mock_aws_config, "alice", ami_id) | ||
|
||
instances = tag(mock_aws_config, ["Project=top secret"], "alice") | ||
|
||
assert len(instances) == 1 | ||
assert instances[0]["Tag: Project"] == "top secret" | ||
|
||
|
||
def test_describe_by_name(mock_aws_config: Config): | ||
launch(mock_aws_config, "alice", ami_id) | ||
launch(mock_aws_config, "alex", ami_id) | ||
|
@@ -260,14 +251,16 @@ def test_describe_columns(mock_aws_config: Config): | |
del mock_aws_config["key_name"] | ||
launch(mock_aws_config, "alice", ami_id) | ||
|
||
instances = describe(config=mock_aws_config, columns="SubnetId,Name,MissingKey") | ||
instances = describe(config=mock_aws_config, columns="SubnetId,Name,MissingKey,Volumes") | ||
print(instances) | ||
|
||
assert len(instances) == 2 | ||
assert instances[0]["Name"] == "alice" | ||
assert instances[1]["Name"] == "sam" | ||
assert "subnet" in instances[0]["SubnetId"] | ||
assert "subnet" in instances[1]["SubnetId"] | ||
assert instances[0]["Volumes"] == ["Size=15 GiB"] | ||
assert instances[1]["Volumes"] == ["Size=15 GiB"] | ||
|
||
# MissingKey will appear without values | ||
assert instances[0]["MissingKey"] is None # type: ignore | ||
|
@@ -280,6 +273,15 @@ def describe_instance0(region_name: str, instance_id: str): | |
return instances["Reservations"][0]["Instances"][0] | ||
|
||
|
||
def test_tag(mock_aws_config: Config): | ||
launch(mock_aws_config, "alice", ami_id) | ||
|
||
instances = tag(mock_aws_config, ["Project=top secret"], "alice") | ||
|
||
assert len(instances) == 1 | ||
assert instances[0]["Tag: Project"] == "top secret" | ||
|
||
|
||
def test_tags(mock_aws_config: Config): | ||
mock_aws_config["additional_tags"] = {"Owner": "[email protected]", "Project": "top secret"} | ||
launch(mock_aws_config, "alice", ami_id) | ||
|