Skip to content

Commit 7ee5d2f

Browse files
authored
Merge pull request #1591 from idan-arm/remote-tag-value-validation
remote: tag value validation in labgrid-client
2 parents c609d2d + aa6b215 commit 7ee5d2f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

labgrid/remote/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ async def create_reservation(self):
14251425
raise UserError(f"'{pair}' is not a valid filter (must contain a '=')")
14261426
if not TAG_KEY.match(k):
14271427
raise UserError(f"Key '{k}' in filter '{pair}' is invalid")
1428-
if not TAG_KEY.match(v):
1428+
if not TAG_VAL.match(v):
14291429
raise UserError(f"Value '{v}' in filter '{pair}' is invalid")
14301430
fltr[k] = v
14311431

tests/test_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def place(coordinator):
1515
spawn.close()
1616
assert spawn.exitstatus == 0, spawn.before.strip()
1717

18-
with pexpect.spawn('python -m labgrid.remote.client -p test set-tags board=bar') as spawn:
18+
with pexpect.spawn('python -m labgrid.remote.client -p test set-tags board=123board') as spawn:
1919
spawn.expect(pexpect.EOF)
2020
spawn.close()
2121
assert spawn.exitstatus == 0, spawn.before.strip()
@@ -271,15 +271,15 @@ def test_remoteplace_target(place_acquire, tmpdir):
271271
t.await_resources(t.resources)
272272

273273
remote_place = t.get_resource("RemotePlace")
274-
assert remote_place.tags == {"board": "bar"}
274+
assert remote_place.tags == {"board": "123board"}
275275

276276
def test_remoteplace_target_without_env(request, place_acquire):
277277
from labgrid import Target
278278
from labgrid.resource import RemotePlace
279279

280280
t = Target(request.node.name)
281281
remote_place = RemotePlace(t, name="test")
282-
assert remote_place.tags == {"board": "bar"}
282+
assert remote_place.tags == {"board": "123board"}
283283

284284
def test_resource_conflict(place_acquire, tmpdir):
285285
with pexpect.spawn('python -m labgrid.remote.client -p test2 create') as spawn:
@@ -303,7 +303,7 @@ def test_resource_conflict(place_acquire, tmpdir):
303303
assert spawn.exitstatus == 0, spawn.before.strip()
304304

305305
def test_reservation(place_acquire, tmpdir):
306-
with pexpect.spawn('python -m labgrid.remote.client reserve --shell board=bar name=test') as spawn:
306+
with pexpect.spawn('python -m labgrid.remote.client reserve --shell board=123board name=test') as spawn:
307307
spawn.expect(pexpect.EOF)
308308
spawn.close()
309309
assert spawn.exitstatus == 0, spawn.before.strip()
@@ -510,7 +510,7 @@ def test_reservation_custom_config(place, exporter, tmpdir):
510510
name: test
511511
"""
512512
)
513-
with pexpect.spawn(f'python -m labgrid.remote.client -c {p} reserve --wait --shell board=bar name=test') as spawn:
513+
with pexpect.spawn(f'python -m labgrid.remote.client -c {p} reserve --wait --shell board=123board name=test') as spawn:
514514
spawn.expect(pexpect.EOF)
515515
spawn.close()
516516
assert spawn.exitstatus == 0, spawn.before.strip()

0 commit comments

Comments
 (0)