Back to Repositories

Testing HTTP Client Integration Workflow in Conductor OSS

This test suite implements end-to-end HTTP integration testing for the Conductor workflow engine. It validates the interaction between various Conductor client components and the API endpoints, ensuring proper communication and functionality across the system.

Test Coverage Overview

The test suite provides comprehensive coverage of HTTP-based interactions between Conductor clients and the server API.

  • Tests Task, Workflow, Metadata and Event client initialization
  • Validates API root URI configuration
  • Ensures proper client-server communication setup
  • Covers core service integration points

Implementation Analysis

The implementation utilizes JUnit’s @Before annotation for test initialization and setup. The testing approach focuses on establishing HTTP client connections and configuring endpoints for each Conductor service component.

The test extends AbstractHttpEndToEndTest, leveraging inheritance for common test functionality while implementing specific HTTP configuration requirements.

Technical Details

  • JUnit testing framework
  • Conductor HTTP client libraries (TaskClient, WorkflowClient, MetadataClient, EventClient)
  • Local server deployment on dynamic port
  • RESTful API endpoint configuration
  • HTTP-based service integration

Best Practices Demonstrated

The test demonstrates several testing best practices including proper separation of concerns and modular test setup.

  • Centralized client initialization
  • Clean setup of test dependencies
  • Consistent API root configuration
  • Proper test inheritance structure
  • Clear component separation

conductor-oss/conductor

test-harness/src/test/java/com/netflix/conductor/test/integration/http/HttpEndToEndTest.java

            
/*
 * Copyright 2022 Conductor Authors.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */
package com.netflix.conductor.test.integration.http;

import org.junit.Before;

import com.netflix.conductor.client.http.EventClient;
import com.netflix.conductor.client.http.MetadataClient;
import com.netflix.conductor.client.http.TaskClient;
import com.netflix.conductor.client.http.WorkflowClient;

public class HttpEndToEndTest extends AbstractHttpEndToEndTest {

    @Before
    public void init() {
        apiRoot = String.format("http://localhost:%d/api/", port);

        taskClient = new TaskClient();
        taskClient.setRootURI(apiRoot);

        workflowClient = new WorkflowClient();
        workflowClient.setRootURI(apiRoot);

        metadataClient = new MetadataClient();
        metadataClient.setRootURI(apiRoot);

        eventClient = new EventClient();
        eventClient.setRootURI(apiRoot);
    }
}