Skip to content

Commit 3b95adc

Browse files
committed
configmap-e2e: use labels
1 parent 5be9c89 commit 3b95adc

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

kubernetes/e2e_test/test_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ def test_configmap_apis(self):
443443
"apiVersion": "v1",
444444
"metadata": {
445445
"name": name,
446+
"labels": {"e2e-tests": "true"},
446447
},
447448
"data": {
448449
"config.json": "{\"command\":\"/usr/bin/mysqld_safe\"}",
@@ -466,7 +467,7 @@ def test_configmap_apis(self):
466467
resp = api.delete_namespaced_config_map(
467468
name=name, body={}, namespace='default')
468469

469-
resp = api.list_namespaced_config_map('default', pretty=True)
470+
resp = api.list_namespaced_config_map('default', pretty=True, label_selector="e2e-tests=true")
470471
self.assertEqual([], resp.items)
471472

472473
def test_node_apis(self):

kubernetes/e2e_test/test_watch.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def config_map_with_value(name, value):
3232
"kind": "ConfigMap",
3333
"metadata": {
3434
"name": name,
35+
"labels": {"e2e-tests": "true"},
3536
},
3637
"data": {
3738
"key": value,
@@ -57,7 +58,7 @@ def test_watch_configmaps(self):
5758
body=configmap_a, namespace='default')
5859

5960
# list all configmaps and extract the resource version
60-
resp = api.list_namespaced_config_map('default')
61+
resp = api.list_namespaced_config_map('default', label_selector="e2e-tests=true")
6162
rv = resp.metadata.resource_version
6263

6364
# create another configmap
@@ -73,7 +74,7 @@ def test_watch_configmaps(self):
7374

7475
# delete all configmaps
7576
api.delete_collection_namespaced_config_map(
76-
namespace='default')
77+
namespace='default', label_selector="e2e-tests=true")
7778

7879
w = watch.Watch()
7980
# expect to observe all events happened after the initial LIST
@@ -83,7 +84,8 @@ def test_watch_configmaps(self):
8384
for event in w.stream(api.list_namespaced_config_map,
8485
namespace='default',
8586
resource_version=rv,
86-
timeout_seconds=5):
87+
timeout_seconds=5,
88+
label_selector="e2e-tests=true"):
8789
self.assertEqual(event['type'], expect[i])
8890
# Kubernetes doesn't guarantee the order of the two objects
8991
# being deleted

0 commit comments

Comments
 (0)