Skip to content

Commit 3849ad9

Browse files
committed
configmap-e2e: use labels
1 parent 5be9c89 commit 3849ad9

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

kubernetes/e2e_test/test_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,9 @@ def test_configmap_apis(self):
443443
"apiVersion": "v1",
444444
"metadata": {
445445
"name": name,
446+
"labels": {
447+
"e2e-test": "true",
448+
},
446449
},
447450
"data": {
448451
"config.json": "{\"command\":\"/usr/bin/mysqld_safe\"}",
@@ -466,7 +469,7 @@ def test_configmap_apis(self):
466469
resp = api.delete_namespaced_config_map(
467470
name=name, body={}, namespace='default')
468471

469-
resp = api.list_namespaced_config_map('default', pretty=True)
472+
resp = api.list_namespaced_config_map('default', pretty=True, label_selector="e2e-test=true")
470473
self.assertEqual([], resp.items)
471474

472475
def test_node_apis(self):

kubernetes/e2e_test/test_watch.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ def config_map_with_value(name, value):
3232
"kind": "ConfigMap",
3333
"metadata": {
3434
"name": name,
35+
"labels": {
36+
"e2e-test": "true",
37+
},
3538
},
3639
"data": {
3740
"key": value,
@@ -57,7 +60,7 @@ def test_watch_configmaps(self):
5760
body=configmap_a, namespace='default')
5861

5962
# list all configmaps and extract the resource version
60-
resp = api.list_namespaced_config_map('default')
63+
resp = api.list_namespaced_config_map('default', label_selector="e2e-test=true")
6164
rv = resp.metadata.resource_version
6265

6366
# create another configmap
@@ -73,7 +76,7 @@ def test_watch_configmaps(self):
7376

7477
# delete all configmaps
7578
api.delete_collection_namespaced_config_map(
76-
namespace='default')
79+
namespace='default', label_selector="e2e-test=true")
7780

7881
w = watch.Watch()
7982
# expect to observe all events happened after the initial LIST
@@ -83,7 +86,8 @@ def test_watch_configmaps(self):
8386
for event in w.stream(api.list_namespaced_config_map,
8487
namespace='default',
8588
resource_version=rv,
86-
timeout_seconds=5):
89+
timeout_seconds=5,
90+
label_selector="e2e-test=true"):
8791
self.assertEqual(event['type'], expect[i])
8892
# Kubernetes doesn't guarantee the order of the two objects
8993
# being deleted

0 commit comments

Comments
 (0)