Commit Graph

14 Commits

Author SHA1 Message Date
Lee Yarwood 753a2ae5d4 fup: Move _wait_for_volume_attach into InstanceHelperMixin
As discussed in I332d4f33ea6b9506cc24ac12e5c0994f208a3107 this is useful
enough to be copied into InstanceHelperMixin.

Most of this change is migrating the original functional test that
introduced _wait_for_volume_attach over to use _IntegratedTestBase.

Change-Id: I345dce93c6e2593c1ff1b863425f9a854c49ab9d
2021-08-04 12:37:43 +01:00
Stephen Finucane c269285568 tests: Move remaining non-libvirt fixtures
Move these to the central place. There's a large amount of test damage
but it's pretty trivial.

Change-Id: If581eb7aa463c9dde13714f34f0f1b41549a7130
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-05-12 16:32:43 +01:00
Stephen Finucane cc45581a18 functional: Add and use 'GlanceFixture'
This rather beefy (but also quite simple) patch replaces the
'stub_out_image_service' call and associated cleanup in all functional
tests with a new 'GlanceFixture', based on the old 'FakeImageService'.
The use of a fixture means we don't have to worry about teardown and
allows us to stub Glance in the same manners as Cinder, Neutron,
Placement etc.

Unit test cleanup is handled in a later patch.

Change-Id: I6daea47988181dfa6dde3d9c42004c0ecf6ae87a
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-09-16 11:31:23 +01:00
Stephen Finucane 57f335090b functional: Rework '_delete_server'
We want 'ServerBase' to inherit from 'InstanceHelperMixin'. They both
have implementations of a "wait until server is deleted" function.  The
'ServerBase' implementation is called '_wait_for_deletion' and takes a
'server_id', while the 'InstanceHelperMixin' implementation is called
'_wait_until_deleted' and takes a full server JSON-y dict. A later
change, I0c56841d098d3e9d72db65be3143f3c893f0b6ba, will rework the
'ServersTestBase' version to bring it inline with 'InstanceHelperMixin'
version. However, 'ServerBase._delete_server' currently calls a
'_wait_for_deletion' function and passes it a 'server_id'. As such,
'_delete_server' itself is only passed a server_id. After the future
change, this 'server_id' will no longer be enough as '_delete_server'
will need to call the newly merged '_wait_until_deleted' that takes a
full server JSON-y dict, so '_delete_server' itself needs to receive a
full server JSON-y dict.

Do this work now to simplify the future patch.

Change-Id: Iceafa5ff2b7abff7c6d974ba49036ef03fb1c85f
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-11-15 16:06:57 +00:00
Eric Fried 86b78739b8 Rename CinderFixtureNewAttachFlow to CinderFixture
The old CinderFixture is gone, so CinderFixtureAttachNewFlow is the new
CinderFixture.

Change-Id: Ie29307d7b4a6d0118a93d2390141403ebe8d5353
2019-07-01 16:00:52 -05:00
Matt Riedemann f260f12ec7 Drop pre-cinder 3.44 version compatibility
The new style volume attach flow semantics, which
were needed to support multiattach volumes, relies
on cinder v3.44 and was added in Queens:

  Ifc01dbf98545104c998ab96f65ff8623a6db0f28

Now that we're in Train, let's require Cinder API
to be at least running Queens level code and drop
the compat checks for queens level nova-compute code
and Cinder API older than Queens.

Lots of old style attachment test code is dropped
as a result since we don't need the version boundary
handling in the API code. The way a lot of the "new
flow" tests were written were as copies of existing
tests modified for the new flow so the old flow tests
could just be dropped later, and that's what happens
in this change.

Change-Id: I6a777b4b7a5729488f939df8c40e49bd40aec3dd
2019-06-27 20:50:45 -04:00
Stephen Finucane 8f6de35636 tests: Stop starting consoleauth in functional tests
This hasn't been needed since we moved console authentication to the
database in Rocky.

Part of blueprint remove-consoleauth

Change-Id: Ie5e7d70f9d6af77edd22756128937f06d0b961a9
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-06-17 15:18:31 +01:00
Chris Dent 787bb33606 Use external placement in functional tests
Adjust the fixtures used by the functional tests so they
use placement database and web fixtures defined by placement
code. To avoid making redundant changes, the solely placement-
related unit and functional tests are removed, but the placement
code itself is not (yet).

openstack-placement is required by the functional tests. It is not
added to test-requirements as we do not want unit tests to depend
on placement in any way, and we enforce this by not having placement
in the test env.

The concept of tox-siblings is used to ensure that the
placement requirement will be satisfied correctly if there is a
depends-on. To make this happen, the functional jobs defined in
.zuul.yaml are updated to require openstack/placement.

tox.ini has to be updated to use a envdir that is the same
name as job. Otherwise the tox siblings role in ansible cannot work.

The handling of the placement fixtures is moved out of nova/test.py
into the functional tests that actually use it because we do not
want unit tests (which get the base test class out of test.py) to
have anything to do with placement. This requires adjusting some
test files to use absolute import.

Similarly, a test of the comparison function for the api samples tests
is moved into functional, because it depends on placement functionality,

TestUpgradeCheckResourceProviders in unit.cmd.test_status is moved into
a new test file: nova/tests/functional/test_nova_status.py. This is done
because it requires the PlacementFixture, which is only available to
functional tests. A MonkeyPatch is required in the test to make sure that
the right context managers are used at the right time in the command
itself (otherwise some tables do no exist). In the test itself, to avoid
speaking directly to the placement database, which would require
manipulating the RequestContext objects, resource providers are now
created over the API.

Co-Authored-By: Balazs Gibizer <balazs.gibizer@ericsson.com>
Change-Id: Idaed39629095f86d24a54334c699a26c218c6593
2018-12-12 18:46:49 +00:00
Lee Yarwood bfdc6a0d52 fixtures: Track volume attachments within CinderFixtureNewAttachFlow
Previously volume attachments ids were not tracked at all within the
fixture with only the instance_uuid and volume_id stashed. This change
should allow future functional tests to exercise bugs where attachments
are deleted but not recreated such as bug #1784353.

Change-Id: Ib30144596fe6a8d8ffbb4ebd695ebcf38ef828a4
Co-authored-by: Matthew Booth <mbooth@redhat.com>
Related-Bug: #1784353
2018-10-22 17:19:31 +01:00
John Griffith 6d70d6adf9 Implement new attach Cinder flow
This change integrates support of the Cinder 3.44
volume attachment API.

The patch bumps the compute service version to
check whether all the compute nodes are upgraded to the
version that can handle attach and detach with the new
flow.

To enable the new flow we also need the 3.44 or higher
microversion from Cinder. We check that in the API and
if it's not available we fall back to the old
attach/detach flow.

Co-Authored-By: Ildiko Vancsa <ildiko.vancsa@gmail.com>

Partially Implements: blueprint cinder-new-attach-apis
Change-Id: Ifc01dbf98545104c998ab96f65ff8623a6db0f28
2017-12-07 10:29:15 -05:00
Balazs Gibizer cc83335987 replace chance with filter scheduler in func tests
FilterScheduler is the only scheduler driver that properly integrated
with placement api so this patch changes the functional test environment
to use the FilterScheduler instead of the ChanceScheduler.

The amount of vcpu the SmallFakeDriver reports need to be bumped to 2
as during resize to same host the filter scheduler doubles the
allocation on the host. Simply relying on the 16.0 default allocation
ratio does not work as the max_unit of the vcpu does not use the
allocation ratio to avoid that a single server overallocates the cpu.

The only change in unit test is
test_create_instance_with_oversubscribed_cpu which also loads the
SmallFakeDriver and asserts available resources on it.

Change-Id: I12de2e195022593ea2a3e2894f2c3b5226930d4f
2017-08-16 14:42:51 +00:00
Takashi NATSUME b32174f22e Stop using mox stubs in cast_as_call.py
Replace mox stubs with stub_out
in nova/tests/unit/cast_as_call.py.

Change-Id: I416835a2fa0ad807f3c35c3cb14b0f463a5d1145
Implements: blueprint remove-mox-pike
2017-07-25 00:40:41 +00:00
Matt Riedemann 9245bbf79d Perform old-style local delete for shelved offloaded instances
This fixes a regression from some local delete code added for cells v2
where it assumed that if an instance did not have a host, it wasn't
scheduled to a cell yet. That assumption misses the fact that the
instance won't have a host if it was shelved offloaded. And to be
shelved offloaded, the instance had to have first been built on a host
in a cell.

So we simply duplicate the same check as later in the _delete() method
for instance.host or shelved-offloaded to decide what the case is.

Obviously this is all a giant mess of duplicate delete path code that
needs to be unwound, and that's the plan, but first we're fixing
regressions and then we can start rolling this duplication all back
so we can get back to the single local delete flow that we know and love.

Change-Id: Ie2063f621618c1d90aeb59f0f1d7da351862ea9f
Closes-Bug: #1678326
2017-04-05 16:27:41 -04:00
Matt Riedemann 3ae12fdc6f Regression test for local delete with an attached volume
Once an instance is in a cell and we do a local delete from
the API, we aren't actually detaching volumes and destroying
BDMs.

Related-Bug: #1675570

Change-Id: Ie3e2dfd4b0f1bb3dff4080f460bf8bb40d69f4f4
2017-04-05 15:36:47 -04:00