Fix race in test_hold_expiration_no_default

The test_hold_expiration_no_default test was misconfigured to use
the nodepool config for the max ready age tests, which was causing
a race in the test where the node could be removed (b/c it exceeded
the max ready age) before it could set a hold. This fixes it to use
a new config, and lowers the TTL on the held node to quicken the test.

Change-Id: Iaeb16e7a11f8b5c7bb2b363b7939fee7933393c4
This commit is contained in:
David Shrewsbury 2018-04-25 14:54:07 -04:00
parent badb7e48ad
commit e1bd967001
2 changed files with 50 additions and 2 deletions

View File

@ -0,0 +1,48 @@
elements-dir: .
images-dir: '{images_dir}'
build-log-dir: '{build_log_dir}'
zookeeper-servers:
- host: {zookeeper_host}
port: {zookeeper_port}
chroot: {zookeeper_chroot}
labels:
- name: fake-label
min-ready: 1
providers:
- name: fake-provider
cloud: fake
driver: fake
region-name: fake-region
rate: 0.0001
diskimages:
- name: fake-image
meta:
key: value
key2: value
pools:
- name: main
max-servers: 96
availability-zones:
- az1
networks:
- net-name
labels:
- name: fake-label
diskimage: fake-image
min-ram: 8192
flavor-name: 'Fake'
diskimages:
- name: fake-image
elements:
- fedora
- vm
release: 21
env-vars:
TMPDIR: /opt/dib_tmp
DIB_IMAGE_CACHE: /opt/dib_cache
DIB_CLOUD_IMAGES: http://download.fedoraproject.org/pub/fedora/linux/releases/test/21-Beta/Cloud/Images/x86_64/
BASE_IMAGE_FILE: Fedora-Cloud-Base-20141029-21_Beta.x86_64.qcow2

View File

@ -735,7 +735,7 @@ class TestLauncher(tests.DBTestCase):
def test_hold_expiration_no_default(self):
"""Test a held node is deleted when past its operator-specified TTL,
no max-hold-age set"""
configfile = self.setup_config('node_max_ready_age.yaml')
configfile = self.setup_config('node_max_hold_age_no_default.yaml')
pool = self.useNodepool(configfile, watermark_sleep=1)
self.useBuilder(configfile)
pool.start()
@ -748,7 +748,7 @@ class TestLauncher(tests.DBTestCase):
# hold the node
node.state = zk.HOLD
node.comment = 'testing'
node.hold_expiration = 5
node.hold_expiration = 1
self.zk.lockNode(node, blocking=False)
self.zk.storeNode(node)
self.zk.unlockNode(node)