コード例 #1
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}\"")
コード例 #2
0
def validate_absent_sb(context, sb_name):
    openshift = Openshift()
    polling2.poll(lambda: openshift.search_resource_in_namespace(
        "servicebindings", sb_name, context.namespace.name),
                  step=5,
                  timeout=400,
                  check_success=lambda v: v is None)
コード例 #3
0
def then_sbo_jsonpath_is(context, json_path, sbr_name, json_value_regex):
    openshift = Openshift()
    assert openshift.search_resource_in_namespace(
        "servicebindings", sbr_name, context.namespace.name) is not None, f"Service Binding '{sbr_name}' does not exist in namespace '{context.namespace.name}'"
    result = openshift.get_resource_info_by_jsonpath("sbr", sbr_name, context.namespace.name, json_path, wait=True, timeout=600)
    assert result is not None, f"Invalid result for SBO jsonpath: {result}."
    assert re.fullmatch(json_value_regex, result) is not None, f"SBO jsonpath result \"{result}\" does not match \"{json_value_regex}\""
コード例 #4
0
def sb_secret_is_not_present(context):
    openshift = Openshift()
    polling2.poll(lambda: openshift.search_resource_in_namespace(
        "secrets", context.sb_secret, context.namespace.name),
                  step=100,
                  timeout=1000,
                  ignore_exceptions=(ValueError, ),
                  check_success=lambda v: v is None)
コード例 #5
0
def validate_absent_sb(context, sb_name):
    openshift = Openshift()
    output = openshift.search_resource_in_namespace("servicebindings", sb_name, context.namespace.name)
    assert output is None, f"Service Binding {sb_name} is present in namespace '{context.namespace.name}'"