Skip to content

Commit

Permalink
Insert waits between modifying Base EDID and GETting Effective EDID
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Nagorny committed Oct 31, 2023
1 parent 5a64c55 commit 1f83676
Showing 1 changed file with 32 additions and 9 deletions.
41 changes: 32 additions & 9 deletions nmostesting/suites/IS1101Test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from functools import partial
import time
import re

Expand Down Expand Up @@ -228,7 +229,10 @@ def test_01_01(self, test):
return test.PASS()

def test_01_02(self, test):
"""Inputs with Base EDID support handles PUTting and DELETing the Base EDID"""
"""Inputs with Base EDID support handle PUTting and DELETing the Base EDID"""
def is_edid_equal_to_effective_edid(self, test, inputId, edid):
return self.get_effective_edid(test, inputId) == edid

if len(self.base_edid_inputs) == 0:
return test.UNCLEAR("Not tested. No inputs with Base EDID support found.")

Expand Down Expand Up @@ -259,7 +263,10 @@ def test_01_02(self, test):
"doesn't match the Base EDID that has been put".format(inputId))

# Verify that /edid/effective returns the last Base EDID put
if self.get_effective_edid(test, inputId) != self.valid_edid:
result = self.wait_until_true(
partial(is_edid_equal_to_effective_edid, self, test, inputId, self.valid_edid)
)
if not result:
return test.FAIL("The Effective EDID of Input {}"
"doesn't match the Base EDID that has been put".format(inputId))

Expand All @@ -276,7 +283,8 @@ def test_01_02(self, test):
"the Stream Compatibility Management API: {}".format(response))

# Verify that /edid/effective returned to its defaults
if self.get_effective_edid(test, inputId) != default_edid:
result = self.wait_until_true(partial(is_edid_equal_to_effective_edid, self, test, inputId, default_edid))
if not result:
return test.FAIL("The Effective EDID of Input {}"
"doesn't match its initial value".format(inputId))

Expand Down Expand Up @@ -3729,6 +3737,12 @@ def test_06_03(self, test):
def test_06_04(self, test):
"""Effective EDID updates if Base EDID changes"""

def is_edid_equal_to_effective_edid(self, test, inputId, edid):
return self.get_effective_edid(test, inputId) == edid

def is_edid_inequal_to_effective_edid(self, test, inputId, edid):
return self.get_effective_edid(test, inputId) != edid

if len(self.base_edid_inputs) == 0:
return test.UNCLEAR("Not tested. No inputs with Base EDID support found.")

Expand All @@ -3744,19 +3758,21 @@ def test_06_04(self, test):
return test.FAIL("Unexpected response from "
"the Stream Compatibility Management API: {}".format(response))

time.sleep(CONFIG.STABLE_STATE_DELAY)

if self.get_effective_edid(test, inputId) == effective_edid_before:
result = self.wait_until_true(
partial(is_edid_inequal_to_effective_edid, self, test, inputId, effective_edid_before)
)
if not result:
return test.FAIL("Effective EDID doesn't change when Base EDID changes")

valid, response = self.do_request("DELETE", self.compat_url + "inputs/" + inputId + "/edid/base")
if not valid or response.status_code != 204:
return test.FAIL("Unexpected response from "
"the Stream Compatibility Management API: {}".format(response))

time.sleep(CONFIG.STABLE_STATE_DELAY)

if self.get_effective_edid(test, inputId) != effective_edid_before:
result = self.wait_until_true(
partial(is_edid_equal_to_effective_edid, self, test, inputId, effective_edid_before)
)
if not result:
return test.FAIL("Effective EDID doesn't restore after Base EDID DELETion")

except json.JSONDecodeError:
Expand Down Expand Up @@ -3922,3 +3938,10 @@ def get_outputs_edid(self, test, output_id):
"the Stream Compatibility Management API: {}".format(response))
)
return response.content

def wait_until_true(self, predicate):
for i in range(0, CONFIG.STABLE_STATE_ATTEMPTS):
if predicate():
return True
time.sleep(CONFIG.STABLE_STATE_DELAY)
return False

0 comments on commit 1f83676

Please sign in to comment.