示例#1
0
def validate_secret_empty(context, secret_name):
    openshift = Openshift()
    try:
        polling2.poll(lambda: json.loads(
            openshift.get_resource_info_by_jq("secrets", secret_name, context.namespace.name, ".data",
                                              wait=False)) == "null", step=5, timeout=20,
                      ignore_exceptions=(json.JSONDecodeError,))
    except polling2.TimeoutException:
        pass
示例#2
0
def sbo_jq_is(context, jq_expression, sbr_name, json_value):
    openshift = Openshift()
    polling2.poll(lambda: json.loads(
        openshift.get_resource_info_by_jq("servicebinding",
                                          sbr_name,
                                          context.namespace.name,
                                          jq_expression,
                                          wait=False)) == json_value,
                  step=5,
                  timeout=800,
                  ignore_exceptions=(json.JSONDecodeError, ))
示例#3
0
def sbo_secret_name_has_been_set(context, sbr_name):
    openshift = Openshift()
    polling2.poll(lambda: json.loads(
        openshift.get_resource_info_by_jq("servicebinding",
                                          sbr_name,
                                          context.namespace.name,
                                          ".status.secret",
                                          wait=False)) != "",
                  step=5,
                  timeout=800,
                  ignore_exceptions=(json.JSONDecodeError, ))
示例#4
0
def validate_secret_empty(context):
    openshift = Openshift()
    if "sbr_name" in context:
        secret = polling2.poll(lambda: get_sbr_secret_name(context), step=100, timeout=1000, ignore_exceptions=(ValueError,),
                               check_success=lambda v: v is not None)
        try:
            polling2.poll(lambda: json.loads(
                openshift.get_resource_info_by_jq("secrets", secret, context.namespace.name, ".data", wait=False)) == "null",
                          step=5, timeout=20, ignore_exceptions=(json.JSONDecodeError,))
        except polling2.TimeoutException:
            pass
    else:
        assert False, "sbr_name not in context"
示例#5
0
def then_sbo_jq_is(context, jq_expression, sbr_name, json_value_regex):
    openshift = Openshift()
    openshift.search_resource_in_namespace(
        "servicebindingrequests", sbr_name, context.namespace.name
    ) | should_not.be_none.desc("SBR {sbr_name} exists")
    result = openshift.get_resource_info_by_jq("sbr",
                                               sbr_name,
                                               context.namespace.name,
                                               jq_expression,
                                               wait=True)
    result | should_not.be_none.desc("jq result")
    re.fullmatch(json_value_regex, result) | should_not.be_none.desc(
        "SBO jq result \"{result}\" should match \"{json_value_regex}\"")