Skip to content

Commit 9962a10

Browse files
author
Andrei Skomorkhov
authored
Merge pull request #24 from qa-dev/QA-7624
QA-7624: refactor capabilities comparator and tests
2 parents 998fe67 + 341549d commit 9962a10

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

pool/capabilities/comparator.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ func (c *Comparator) Compare(desired Capabilities, available Capabilities) bool
3838
if !c.isRegistered(name) {
3939
continue
4040
}
41+
// workaround for support jsonwire clients
4142
if name == "platform" && currCap == "ANY" {
42-
currCap = available[name]
43+
continue
4344
}
4445
if !reflect.DeepEqual(currCap, available[name]) {
4546
return false

pool/capabilities/comparator_test.go

+10
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ func TestComparator_Compare(t *testing.T) {
5151
{
5252
expectedResult: true,
5353
},
54+
{
55+
Capabilities{"platform": "ANY", "myDogName": "petr"},
56+
Capabilities{"platform": "LINUX-TORVALDS"},
57+
true,
58+
},
59+
{
60+
Capabilities{"platform": "ANY", "myDogName": "petr"},
61+
Capabilities{"not-defined-platform": "trololo"},
62+
true,
63+
},
5464
}
5565

5666
comp := NewComparator()

0 commit comments

Comments
 (0)