Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix apt default integration test #845

Merged
merged 3 commits into from
Mar 19, 2021

Conversation

TheRealFalcon
Copy link
Member

@TheRealFalcon TheRealFalcon commented Mar 16, 2021

The apt default test wasn't ported over from cloud-tests correctly.
Fix it so it works as it did in the cloud tests.

Also add openstack specific test for apt configuration with no uri.

Proposed Commit Message

Fix apt default integration test

The apt default test wasn't ported over from cloud-tests correctly.
uri should be specified in the test, but it was not, so the test
failed on openstack (and likely other platforms) because without
a specified uri, the default uri will vary by platform. I separated
this uri test out into a separate test function.

Also add openstack specific test for apt configuration with no uri.
Other platform-specific tests should be added here over time.

Additional Context

n/a

Test Steps

Run integration tests on openstack

Checklist:

  • My code follows the process laid out in the documentation
  • I have updated or added any unit tests accordingly
  • I have updated or added any documentation accordingly

The apt default test wasn't ported over from cloud-tests correctly.
Fix it so it works as it did in the cloud tests.

Also add openstack specific test for apt configuration with no uri.
@TheRealFalcon TheRealFalcon changed the title Fix apt default test Fix apt default integration test Mar 16, 2021
@OddBloke
Copy link
Collaborator

Some information in the commit message about how the porting was incorrect would be good: I'm struggling to determine what here is remedial, and what is new testing.


@pytest.mark.user_data(DEFAULT_DATA)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't think we need this?

Comment on lines 226 to 232
version = class_client.execute(
'curl http://169.254.169.254'
).split('\n')[-1]
zone = class_client.execute(
'curl http://169.254.169.254/{}/meta-data/placement/'
'availability-zone'.format(version),
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we use cloud-init query v1.availability_zone here instead?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Generalising it is out-of-scope for this PR, but if we do, can this test run on more than just OpenStack? We perform region/AZ substitution on every cloud; an EC2 instance I have kicking around, for example:

deb http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ focal main restricted

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, I noticed there there were different templates for different clouds, so I figured we would want multiple versions, but since I was just testing on openstack, I started with openstack.

@TheRealFalcon
Copy link
Member Author

I updated the commit message on the PR (not in the actual commit). Is that enough context?

Copy link
Collaborator

@OddBloke OddBloke left a comment

Choose a reason for hiding this comment

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

Thanks, exactly what I needed. Confirmed that these tests pass locally.

@OddBloke OddBloke merged commit c6726c2 into canonical:master Mar 19, 2021
@TheRealFalcon TheRealFalcon deleted the fix-apt-tests branch June 29, 2021 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants