Skip to content

new: Support Image Gen2 functionalities#428

Merged
yec-akamai merged 8 commits intoproj/image-gen2from
TPT-2896/support-image-gen2
Jul 2, 2024
Merged

new: Support Image Gen2 functionalities#428
yec-akamai merged 8 commits intoproj/image-gen2from
TPT-2896/support-image-gen2

Conversation

@yec-akamai
Copy link
Copy Markdown
Contributor

@yec-akamai yec-akamai commented Jun 24, 2024

📝 Description

Support the new image fields, including tags, total_size, regions. Support image replication.

✔️ How to Test

Unite test:

make testunit

Before running the integration test, you'll need to set up these environment variables:

export LINODE_API_URL=https://.../v4
export LINODE_API_CA=$PWD/cacert.pem
export LINODE_TOKEN=...

Integration test:

make testint TEST_SUITE=linode_client
make testint TEST_SUITE=image TEST_CASE=test_image_create_upload
make testint TEST_SUITE=image TEST_CASE=test_get_image

# replication is not functional yet
# make testint TEST_SUITE=image TEST_CASE=test_image_replication

Manual Test

  1. In a sandbox environment, run the following to create an image with tags:
import os
from linode_api4 import LinodeClient

client = LinodeClient(
        os.getenv("LINODE_TOKEN"),
        base_url="https://.../v4",
        ca_path=".../CA.pem",
)
    
linode, _ = client.linode.instance_create(
    "g6-nanode-1",
    "us-east",
    label="test-image-gen2",
    image="linode/alpine3.19",
)

image = client.image_create(
    disk=linode.disks[0].id, label="image-gen-2", description="Test", tags=["test", "image-gen2"]
)

print(image.tags)
print(image.total_size)
# regions is expected to be empty here since it's not properly functional yet
print(image.regions)

linode.delete()
image.delete()
  1. Observe that new fields tags, total_size, and regions are populated.

@yec-akamai yec-akamai requested a review from a team as a code owner June 24, 2024 20:13
@yec-akamai yec-akamai requested review from ykim-akamai and zliang-akamai and removed request for a team June 24, 2024 20:13
@yec-akamai yec-akamai added the new-feature for new features in the changelog. label Jun 26, 2024
@yec-akamai yec-akamai requested a review from zliang-akamai June 28, 2024 17:33
Copy link
Copy Markdown
Member

@zliang-akamai zliang-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks great, and it's tested. Nice work!

Copy link
Copy Markdown
Contributor

@ykim-akamai ykim-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, verified locally. Excellent work!

@yec-akamai yec-akamai merged commit 75c04f8 into proj/image-gen2 Jul 2, 2024
@yec-akamai yec-akamai deleted the TPT-2896/support-image-gen2 branch July 2, 2024 16:55
yec-akamai added a commit that referenced this pull request Aug 9, 2024
* new: Support Image Gen2 functionalities (#428)

* image gen2

* nit

* lint

* fix strenum import

* sort imports

* add int test

* address comments

* rename

* added LA disclamier; modified replication test case

* use random region in test_linode_client with caps; use stable regions for image gen2

* fix int test

* fix lint

* replace todo with doc link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature for new features in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants