red-hat-storage / ocs-ci

https://ocs-ci.readthedocs.io/en/latest/
MIT License
108 stars 168 forks source link

test_registry_by_increasing_num_of_registry_pods failed due to 'unable to locate any templates loaded in accessible projects with name "redis-ephemeral"' #9006

Closed nagendra202 closed 8 months ago

nagendra202 commented 12 months ago

Message: ocs_ci.ocs.exceptions.CommandFailed: Error during execution of command: oc new-app --template=redis-ephemeral -n test --name=build1. Error is error: Error from server (ServiceUnavailable): the server is currently unable to handle the request (get templates.template.openshift.io) error: unable to locate any templates loaded in accessible projects with name "redis-ephemeral"

The 'oc new-app' command will match arguments to the following types:

Images tagged into image streams in the current project or the 'openshift' project

if you don't specify a tag, we'll add ':latest'

Images in the container storage, on remote registries, or on the local container engine

Templates in the current project or the 'openshift' project

Git repository URLs or local paths that point to Git repositories

--allow-missing-images can be used to point to an image that does not exist yet.

See 'oc new-app -h' for examples. Type: None

Text: self = <tests.e2e.workloads.ocp.registry.test_registry_by_increasing_num_of_image_registry_pods.TestRegistryByIncreasingNumPods object at 0x7fd25600bd00> threading_lock = <unlocked _thread.RLock object owner=0 count=0 at 0x7fd2b6a2f060> count = 3

@pytest.mark.polarion_id("OCS-1900") def test_registry_by_increasing_num_of_registry_pods(self, threading_lock, count=3): """ Test registry by increasing number of registry pods and validate all the image-registry pod should have the same PVC backend.

"""
api = prometheus.PrometheusAPI(threading_lock=threading_lock)

# Increase the replica count to 3
assert modify_registry_pod_count(
    count
), "Number of registry pod doesn't match the count"

# Validate image registry pods
validate_registry_pod_status()

# Validate pvc mounted on image registry pod
validate_pvc_mount_on_registry_pod()

# Pull and push images to registries
log.info("Pull and push images to registries")

image_pull_and_push(project_name=self.project_name)

tests/e2e/workloads/ocp/registry/test_registry_by_increasing_num_of_image_registry_pods.py:85:

ocs_ci/ocs/registry.py:385: in image_pull_and_push ocp_obj.exec_oc_cmd(command=cmd, out_yaml_format=False) ocs_ci/ocs/ocp.py:178: in exec_oc_cmd out = run_cmd( ocs_ci/utility/utils.py:484: in run_cmd completed_process = exec_cmd(

cmd = ['oc', '--kubeconfig', '/home/jenkins/current-cluster-dir/openshift-cluster-dir/auth/kubeconfig', 'new-app', '--template=redis-ephemeral', '-n', ...] secrets = None, timeout = 600, ignore_error = False, threading_lock = None silent = False, use_shell = False cluster_config = <ocs_ci.framework.MultiClusterConfig object at 0x7fd2ea270fd0> kwargs = {} masked_cmd = 'oc new-app --template=redis-ephemeral -n test --name=build1' kubepath = '/home/jenkins/current-cluster-dir/openshift-cluster-dir/auth/kubeconfig' completed_process = CompletedProcess(args=['oc', '--kubeconfig', '/home/jenkins/current-cluster-dir/openshift-cluster-dir/auth/kubeconfig'...low-missing-images can be used to point to an image that does not exist yet.\n\nSee 'oc new-app -h' for examples.\n') masked_stdout = '' masked_stderr = "error: Error from server (ServiceUnavailable): the server is currently unable to handle the request (get templates.te...-allow-missing-images can be used to point to an image that does not exist yet.\n\nSee 'oc new-app -h' for examples.\n"

def exec_cmd( cmd, secrets=None, timeout=600, ignore_error=False, threading_lock=None, silent=False, use_shell=False, cluster_config=None, **kwargs, ): """ Run an arbitrary command locally

If the command is grep and matching pattern is not found, then this function
returns "command terminated with exit code 1" in stderr.

Args:
    cmd (str): command to run
    secrets (list): A list of secrets to be masked with asterisks
        This kwarg is popped in order to not interfere with
        subprocess.run(``**kwargs``)
    timeout (int): Timeout for the command, defaults to 600 seconds.
    ignore_error (bool): True if ignore non zero return code and do not
        raise the exception.
    threading_lock (threading.RLock): threading.RLock object that is used
        for handling concurrent oc commands
    silent (bool): If True will silent errors from the server, default false
    use_shell (bool): If True will pass the cmd without splitting
    cluster_config (MultiClusterConfig): In case of multicluster environment this object
            will be non-null

Raises:
    CommandFailed: In case the command execution fails

Returns:
    (CompletedProcess) A CompletedProcess object of the command that was executed
    CompletedProcess attributes:
    args: The list or str args passed to run().
    returncode (str): The exit code of the process, negative for signals.
    stdout     (str): The standard output (None if not captured).
    stderr     (str): The standard error (None if not captured).

"""
masked_cmd = mask_secrets(cmd, secrets)
log.info(f"Executing command: {masked_cmd}")
if isinstance(cmd, str) and not kwargs.get("shell"):
    cmd = shlex.split(cmd)
if cluster_config and cmd[0] == "oc" and "--kubeconfig" not in cmd:
    kubepath = cluster_config.RUN["kubeconfig"]
    cmd = list_insert_at_position(cmd, 1, ["--kubeconfig"])
    cmd = list_insert_at_position(cmd, 2, [kubepath])
if threading_lock and cmd[0] == "oc":
    threading_lock.acquire()
completed_process = subprocess.run(
    cmd,
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE,
    stdin=subprocess.PIPE,
    timeout=timeout,
    **kwargs,
)
if threading_lock and cmd[0] == "oc":
    threading_lock.release()
masked_stdout = mask_secrets(completed_process.stdout.decode(), secrets)
if len(completed_process.stdout) > 0:
    log.debug(f"Command stdout: {masked_stdout}")
else:
    log.debug("Command stdout is empty")

masked_stderr = mask_secrets(completed_process.stderr.decode(), secrets)
if len(completed_process.stderr) > 0:
    if not silent:
        log.warning(f"Command stderr: {masked_stderr}")
else:
    log.debug("Command stderr is empty")
log.debug(f"Command return code: {completed_process.returncode}")
if completed_process.returncode and not ignore_error:
    masked_stderr = bin_xml_escape(filter_out_emojis(masked_stderr))
    if (
        "grep" in masked_cmd
        and b"command terminated with exit code 1" in completed_process.stderr
    ):
        log.info(f"No results found for grep command: {masked_cmd}")
    else:

      raise CommandFailed(
            f"Error during execution of command: {masked_cmd}."
            f"\nError is {masked_stderr}"
        )

E ocs_ci.ocs.exceptions.CommandFailed: Error during execution of command: oc new-app --template=redis-ephemeral -n test --name=build1. E Error is error: Error from server (ServiceUnavailable): the server is currently unable to handle the request (get templates.template.openshift.io) E error: unable to locate any templates loaded in accessible projects with name "redis-ephemeral" E E The 'oc new-app' command will match arguments to the following types: E E 1. Images tagged into image streams in the current project or the 'openshift' project E - if you don't specify a tag, we'll add ':latest' E 2. Images in the container storage, on remote registries, or on the local container engine E 3. Templates in the current project or the 'openshift' project E 4. Git repository URLs or local paths that point to Git repositories E E --allow-missing-images can be used to point to an image that does not exist yet. E E See 'oc new-app -h' for examples.

ocs_ci/utility/utils.py:664: CommandFailed

2023-12-04 01:25:35 Message: ocs_ci.ocs.exceptions.CommandFailed: Error during execution of command: oc new-app --template=redis-ephemeral -n test --name=build1. Error is error: Error from server (ServiceUnavailable): the server is currently unable to handle the request (get templates.template.openshift.io) error: unable to locate any templates loaded in accessible projects with name "redis-ephemeral"

The 'oc new-app' command will match arguments to the following types:

Images tagged into image streams in the current project or the 'openshift' project

if you don't specify a tag, we'll add ':latest'

Images in the container storage, on remote registries, or on the local container engine

Templates in the current project or the 'openshift' project

Git repository URLs or local paths that point to Git repositories

--allow-missing-images can be used to point to an image that does not exist yet.

See 'oc new-app -h' for examples. Type: None

Text: self = <tests.e2e.workloads.ocp.registry.test_registry_by_increasing_num_of_image_registry_pods.TestRegistryByIncreasingNumPods object at 0x7fd25600bd00> threading_lock = <unlocked _thread.RLock object owner=0 count=0 at 0x7fd2b6a2f060> count = 3

@pytest.mark.polarion_id("OCS-1900") def test_registry_by_increasing_num_of_registry_pods(self, threading_lock, count=3): """ Test registry by increasing number of registry pods and validate all the image-registry pod should have the same PVC backend.

"""
api = prometheus.PrometheusAPI(threading_lock=threading_lock)

# Increase the replica count to 3
assert modify_registry_pod_count(
    count
), "Number of registry pod doesn't match the count"

# Validate image registry pods
validate_registry_pod_status()

# Validate pvc mounted on image registry pod
validate_pvc_mount_on_registry_pod()

# Pull and push images to registries
log.info("Pull and push images to registries")

image_pull_and_push(project_name=self.project_name)

tests/e2e/workloads/ocp/registry/test_registry_by_increasing_num_of_image_registry_pods.py:85:

ocs_ci/ocs/registry.py:385: in image_pull_and_push ocp_obj.exec_oc_cmd(command=cmd, out_yaml_format=False) ocs_ci/ocs/ocp.py:178: in exec_oc_cmd out = run_cmd( ocs_ci/utility/utils.py:484: in run_cmd completed_process = exec_cmd(

cmd = ['oc', '--kubeconfig', '/home/jenkins/current-cluster-dir/openshift-cluster-dir/auth/kubeconfig', 'new-app', '--template=redis-ephemeral', '-n', ...] secrets = None, timeout = 600, ignore_error = False, threading_lock = None silent = False, use_shell = False cluster_config = <ocs_ci.framework.MultiClusterConfig object at 0x7fd2ea270fd0> kwargs = {} masked_cmd = 'oc new-app --template=redis-ephemeral -n test --name=build1' kubepath = '/home/jenkins/current-cluster-dir/openshift-cluster-dir/auth/kubeconfig' completed_process = CompletedProcess(args=['oc', '--kubeconfig', '/home/jenkins/current-cluster-dir/openshift-cluster-dir/auth/kubeconfig'...low-missing-images can be used to point to an image that does not exist yet.\n\nSee 'oc new-app -h' for examples.\n') masked_stdout = '' masked_stderr = "error: Error from server (ServiceUnavailable): the server is currently unable to handle the request (get templates.te...-allow-missing-images can be used to point to an image that does not exist yet.\n\nSee 'oc new-app -h' for examples.\n"

def exec_cmd( cmd, secrets=None, timeout=600, ignore_error=False, threading_lock=None, silent=False, use_shell=False, cluster_config=None, **kwargs, ): """ Run an arbitrary command locally

If the command is grep and matching pattern is not found, then this function
returns "command terminated with exit code 1" in stderr.

Args:
    cmd (str): command to run
    secrets (list): A list of secrets to be masked with asterisks
        This kwarg is popped in order to not interfere with
        subprocess.run(``**kwargs``)
    timeout (int): Timeout for the command, defaults to 600 seconds.
    ignore_error (bool): True if ignore non zero return code and do not
        raise the exception.
    threading_lock (threading.RLock): threading.RLock object that is used
        for handling concurrent oc commands
    silent (bool): If True will silent errors from the server, default false
    use_shell (bool): If True will pass the cmd without splitting
    cluster_config (MultiClusterConfig): In case of multicluster environment this object
            will be non-null

Raises:
    CommandFailed: In case the command execution fails

Returns:
    (CompletedProcess) A CompletedProcess object of the command that was executed
    CompletedProcess attributes:
    args: The list or str args passed to run().
    returncode (str): The exit code of the process, negative for signals.
    stdout     (str): The standard output (None if not captured).
    stderr     (str): The standard error (None if not captured).

"""
masked_cmd = mask_secrets(cmd, secrets)
log.info(f"Executing command: {masked_cmd}")
if isinstance(cmd, str) and not kwargs.get("shell"):
    cmd = shlex.split(cmd)
if cluster_config and cmd[0] == "oc" and "--kubeconfig" not in cmd:
    kubepath = cluster_config.RUN["kubeconfig"]
    cmd = list_insert_at_position(cmd, 1, ["--kubeconfig"])
    cmd = list_insert_at_position(cmd, 2, [kubepath])
if threading_lock and cmd[0] == "oc":
    threading_lock.acquire()
completed_process = subprocess.run(
    cmd,
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE,
    stdin=subprocess.PIPE,
    timeout=timeout,
    **kwargs,
)
if threading_lock and cmd[0] == "oc":
    threading_lock.release()
masked_stdout = mask_secrets(completed_process.stdout.decode(), secrets)
if len(completed_process.stdout) > 0:
    log.debug(f"Command stdout: {masked_stdout}")
else:
    log.debug("Command stdout is empty")

masked_stderr = mask_secrets(completed_process.stderr.decode(), secrets)
if len(completed_process.stderr) > 0:
    if not silent:
        log.warning(f"Command stderr: {masked_stderr}")
else:
    log.debug("Command stderr is empty")
log.debug(f"Command return code: {completed_process.returncode}")
if completed_process.returncode and not ignore_error:
    masked_stderr = bin_xml_escape(filter_out_emojis(masked_stderr))
    if (
        "grep" in masked_cmd
        and b"command terminated with exit code 1" in completed_process.stderr
    ):
        log.info(f"No results found for grep command: {masked_cmd}")
    else:

      raise CommandFailed(
            f"Error during execution of command: {masked_cmd}."
            f"\nError is {masked_stderr}"
        )

E ocs_ci.ocs.exceptions.CommandFailed: Error during execution of command: oc new-app --template=redis-ephemeral -n test --name=build1. E Error is error: Error from server (ServiceUnavailable): the server is currently unable to handle the request (get templates.template.openshift.io) E error: unable to locate any templates loaded in accessible projects with name "redis-ephemeral" E E The 'oc new-app' command will match arguments to the following types: E E 1. Images tagged into image streams in the current project or the 'openshift' project E - if you don't specify a tag, we'll add ':latest' E 2. Images in the container storage, on remote registries, or on the local container engine E 3. Templates in the current project or the 'openshift' project E 4. Git repository URLs or local paths that point to Git repositories E E --allow-missing-images can be used to point to an image that does not exist yet. E E See 'oc new-app -h' for examples.

ocs_ci/utility/utils.py:664: CommandFailed

RP: https://reportportal-ocs4.apps.ocp-c1.prod.psi.redhat.com/ui/#ocs/launches/557/17069/828575/828638/828640/log?logParams=history%3D828639%26page.page%3D1

github-actions[bot] commented 9 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs.

github-actions[bot] commented 8 months ago

This issue has been automatically closed due to inactivity. Please re-open if this still requires investigation.