Skip to content

Added integration tests#481

Open
Sharpz7 wants to merge 8 commits intoopenstack-exporter:mainfrom
Sharpz7:integration-tests
Open

Added integration tests#481
Sharpz7 wants to merge 8 commits intoopenstack-exporter:mainfrom
Sharpz7:integration-tests

Conversation

@Sharpz7
Copy link
Copy Markdown
Collaborator

@Sharpz7 Sharpz7 commented Sep 3, 2025

This should help make trusting new changes easier.

@Sharpz7 Sharpz7 added the priority Priority PR or Issue to help with tracking. label Sep 3, 2025
@Sharpz7
Copy link
Copy Markdown
Collaborator Author

Sharpz7 commented Sep 3, 2025

This is copying a significant amount of code from https://github.com/gophercloud/gophercloud/tree/main/internal/acceptance. I am going to create a ticket there about potentially trying to expose this code out instead of copying it.

@Sharpz7 Sharpz7 removed the priority Priority PR or Issue to help with tracking. label Sep 3, 2025
@Sharpz7 Sharpz7 marked this pull request as draft September 3, 2025 04:18
This was referenced Oct 30, 2025
@Sharpz7 Sharpz7 marked this pull request as ready for review December 2, 2025 04:43
@Sharpz7 Sharpz7 requested a review from Copilot December 2, 2025 04:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces comprehensive integration tests for the OpenStack exporter, enabling automated testing against live OpenStack services (Ironic, Nova, Neutron, Glance, Keystone, Placement) via DevStack in CI. The tests validate that the exporter correctly generates Prometheus metrics from real OpenStack resources.

Key Changes

  • Added integration test infrastructure with helper packages for creating test resources and clients
  • Created service-specific integration test suites (baremetal, compute, networking, images, identity, placement)
  • Set up GitHub Actions workflows to run integration tests on pull requests using DevStack

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
script/stackenv Bash script to prepare DevStack testing environment with required resources and environment variables
script/integration-suites/* Individual test runner scripts for each OpenStack service integration test suite
script/collectlogs Utility script to collect diagnostic logs after integration test failures
integration/utils.go Core integration test utilities for starting the OpenStack exporter
integration/tools/tools.go Helper functions for waiting, random generation, and resource printing in tests
integration/tools/pkg.go Build tags and package documentation for test tools
integration/funcs/compute.go Helper functions for creating and managing compute resources in tests
integration/funcs/baremetal.go Helper functions for creating and managing baremetal nodes in tests
integration/funcs/pkg.go Build tags and package documentation for test resource functions
integration/clients/clients.go OpenStack service client creation functions for various services
integration/clients/conditions.go Test skip conditions for different OpenStack configurations and features
integration/clients/http.go HTTP round tripper with request/response logging and header redaction
integration/*_test.go Integration test files validating exporter metrics for each OpenStack service
.github/workflows/integration-*.yaml GitHub Actions workflows for running integration tests in CI
.github/workflows/ci.yaml Updated to exclude integration tests from unit test runs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@openstack-exporter openstack-exporter deleted a comment from Copilot AI Dec 2, 2025
CI Fixes

Fixing more lint errors

Tried to make tests more specific

Fixed issues

Fixes

Fixes

More fixes

Trying more

Test

Fix

Testing

Testing

Changes

Removing placement

Trying things out

More changes

Testing

Trying things

Fixes

Fixes

chore(deps): bump actions/checkout from 4 to 6

Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](actions/checkout@v4...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Update integration/funcs/compute.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Update script/stackenv

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

chore(deps): bump reviewdog/action-actionlint from 1.66.1 to 1.69.0

Bumps [reviewdog/action-actionlint](https://github.com/reviewdog/action-actionlint) from 1.66.1 to 1.69.0.
- [Release notes](https://github.com/reviewdog/action-actionlint/releases)
- [Commits](reviewdog/action-actionlint@e37e2ca...437bbe9)

---
updated-dependencies:
- dependency-name: reviewdog/action-actionlint
  dependency-version: 1.69.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@openstack-exporter openstack-exporter deleted a comment from Copilot AI Dec 2, 2025
@openstack-exporter openstack-exporter deleted a comment from Copilot AI Dec 2, 2025
@openstack-exporter openstack-exporter deleted a comment from Copilot AI Dec 2, 2025
@openstack-exporter openstack-exporter deleted a comment from Copilot AI Dec 2, 2025
@openstack-exporter openstack-exporter deleted a comment from Copilot AI Dec 2, 2025
@Sharpz7
Copy link
Copy Markdown
Collaborator Author

Sharpz7 commented Dec 2, 2025

Service Test Name Coverage
Baremetal (Ironic) TestBaremetalIntegration openstack_ironic_node metric with labels (console_enabled, deploy_kernel, deploy_ramdisk, id, maintenance, name, power_state, provision_state, resource_class, retired, retired_reason); openstack_ironic_up metric; metric metadata (HELP and TYPE comments)
Compute (Nova) TestComputeIntegration openstack_nova_server_status metric for specific server; openstack_nova_total_vms metric; openstack_nova_server_local_gb metric; availability_zone label on server status; openstack_nova_quota_instances for admin tenant; openstack_nova_quota_key_pairs limit for admin tenant
Identity (Keystone) TestIdentityIntegration openstack_identity_up metric with value 1; metric metadata (HELP and TYPE comments); core metrics presence (openstack_identity_projects, openstack_identity_users, openstack_identity_domains); openstack_identity_project_info line format with labels (id, name, domain_id, enabled, parent_id)
Image (Glance) TestImagesIntegration openstack_glance_up metric with value 1; metric metadata (HELP and TYPE comments); core metrics presence (openstack_glance_images, openstack_glance_image_bytes, openstack_glance_image_created_at); openstack_glance_image_bytes line format; openstack_glance_image_created_at line format with labels (hidden, id, name, status, tenant_id, visibility)
Network (Neutron) TestNetworkingIntegration openstack_neutron_up metric with value 1; metric metadata (HELP and TYPE comments); core metrics presence (openstack_neutron_networks, openstack_neutron_ports, openstack_neutron_subnets, openstack_neutron_router); openstack_neutron_network line format with labels (id, name, is_external, is_shared, provider_network_type)

@Sharpz7
Copy link
Copy Markdown
Collaborator Author

Sharpz7 commented Dec 2, 2025

I think the main thing to not is BASIS_OPS for ironic is false. For some reason, this makes the tests pass, where they didn't before

@Sharpz7
Copy link
Copy Markdown
Collaborator Author

Sharpz7 commented Dec 4, 2025

@vooon - I'd appreciate your feedback on this in any capacity

Copy link
Copy Markdown
Contributor

@vooon vooon left a comment

Choose a reason for hiding this comment

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

@Sharpz7 here are a few notes.

Also might be helpful to setup slog to show debug.

@Sharpz7
Copy link
Copy Markdown
Collaborator Author

Sharpz7 commented Dec 5, 2025

@vooon appreciate this. Thank you!

Copy link
Copy Markdown

@ClifHouck ClifHouck left a comment

Choose a reason for hiding this comment

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

I mostly skimmed this. It looks fine on the surface, you can always disable it later or correct things if there's flakiness.

// The instance will be launched on the network specified in OS_NETWORK_NAME.
// An error will be returned if the instance was unable to be created.
func CreateServer(t *testing.T, client *gophercloud.ServiceClient) (*servers.Server, error) {
choices, err := clients.AcceptanceTestChoicesFromEnv()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do these choices get logged somewhere?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It gets defined here. I took this code directly from gophercloud. I do want them to export it publicly but that is in the works (gophercloud/gophercloud#3501)

I can log if you would like

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants