Fix infinite recursion in GCE provider
Providers have pools have a provider have pools...
This fix mirrors the approach from the AWS driver.
Change-Id: I33be1ba7c604754139566642ca6a863304a74e73
(cherry picked from commit 559e3098d1
)
This commit is contained in:
parent
1dbb4746d8
commit
063e230bd9
|
@ -54,6 +54,8 @@ class ProviderCloudImage(ConfigValue):
|
|||
|
||||
|
||||
class ProviderLabel(ConfigValue):
|
||||
ignore_equality = ['pool']
|
||||
|
||||
def __init__(self):
|
||||
self.name = None
|
||||
self.cloud_image = None
|
||||
|
@ -79,6 +81,8 @@ class ProviderLabel(ConfigValue):
|
|||
|
||||
|
||||
class ProviderPool(ConfigPool):
|
||||
ignore_equality = ['provider']
|
||||
|
||||
def __init__(self):
|
||||
self.name = None
|
||||
self.host_key_checking = True
|
||||
|
|
|
@ -18,6 +18,7 @@ import os
|
|||
import tempfile
|
||||
import time
|
||||
from unittest.mock import patch
|
||||
from functools import wraps
|
||||
|
||||
import yaml
|
||||
|
||||
|
@ -234,9 +235,9 @@ class TestDriverGce(tests.DBTestCase):
|
|||
except Exception:
|
||||
pass
|
||||
|
||||
def _test_gce_machine(self, label,
|
||||
is_valid_config=True,
|
||||
host_key_checking=True):
|
||||
def _test_with_pool(the_test):
|
||||
@wraps(the_test)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
self.patch(googleapiclient, 'discovery', GCloudEmulator())
|
||||
|
||||
conf_template = os.path.join(
|
||||
|
@ -253,13 +254,24 @@ class TestDriverGce(tests.DBTestCase):
|
|||
'cert': self.zookeeper_cert,
|
||||
'key': self.zookeeper_key,
|
||||
}
|
||||
|
||||
with tempfile.NamedTemporaryFile() as tf:
|
||||
tf.write(yaml.safe_dump(
|
||||
raw_config, default_flow_style=False).encode('utf-8'))
|
||||
tf.flush()
|
||||
configfile = self.setup_config(tf.name)
|
||||
pool = self.useNodepool(configfile, watermark_sleep=1)
|
||||
the_test(self, pool, *args, **kwargs)
|
||||
return wrapper
|
||||
|
||||
@_test_with_pool
|
||||
def test_gce_reconfigure(self, pool):
|
||||
pool.updateConfig()
|
||||
pool.updateConfig()
|
||||
|
||||
@_test_with_pool
|
||||
def _test_gce_machine(self, pool, label,
|
||||
is_valid_config=True,
|
||||
host_key_checking=True):
|
||||
pool.start()
|
||||
|
||||
self._wait_for_provider(pool, 'gcloud-provider')
|
||||
|
|
Loading…
Reference in New Issue