Skip to content

BinaryClient returns null instead of error output when deleting non-existent resource #626

@kstekovi

Description

@kstekovi

Problem Description

When using OpenShifts.adminBinary().execute() to delete a non-existent resource, the method returns null instead of the actual error message from the oc command.

Expected Behavior

When executing oc delete kafkatopic abc on a non-existent resource manually, the command outputs an error message such as:

Error from server (NotFound): kafkatopics.kafka.strimzi.io "abc" not found

Actual Behavior

When the same command is executed via XTF's OpenShifts.adminBinary(namespace).execute("delete", "kafkatopic", "abc"), the method returns null instead of the error message.

Reproduction

Test Code:

@Test
public void testDeleteNonExistentKafkaTopic() {
    LOG.info("Attempting to delete non-existent Kafka topic: {}", TOPIC_NAME);
    
    String result = OpenShifts.adminBinary(NAMESPACE).execute("delete", "kafkatopic", TOPIC_NAME);
    
    LOG.info("Delete command result: {}", result);  // Logs: "Delete command result: null"
}

Manual execution:

$ oc delete kafkatopic abc
Error from server (NotFound): kafkatopics.kafka.strimzi.io "abc" not found

Impact

This makes it difficult to properly handle error cases in tests, as there's no way to distinguish between:

  • Successful deletion (returns null)
  • Resource not found (returns null)
  • Other errors (returns null)

Expected Fix

The BinaryClient.execute() method should return the error output from stderr when the command fails, similar to how manual oc command execution works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions