Skip to content

Testing GraphQL API

Queries and mutations for managing integration tests. Integration tests verify end-to-end data processing by ingesting test data and validating the resulting DeltaFile state. For background, see Integration Testing.

Queries

Get Integration Tests

graphql
# List all integration tests
query {
  getIntegrationTests {
    name
    description
    plugins { groupId artifactId version }
    dataSources
    transformationFlows
    dataSinks
    timeout
  }
}

# Get a specific test
query {
  getIntegrationTest(name: "my-test") {
    name
    description
    inputs {
      dataSource
      contentType
      ingressFileName
      base64Encoded
      data
      metadata { key value }
    }
    expectedDeltaFiles {
      stage
      childCount
      expectedFlows {
        flow
        type
        state
        actions
        metadata { containsKeys keyValueMatchers { name value exact } }
      }
      expectedContent {
        flow
        action
        data { name mediaType contains value }
      }
      annotations { containsKeys }
    }
    timeout
  }
}

Permission: IntegrationTestView

Get Test Results

graphql
# List all test results
query {
  getTestResults {
    id
    testName
    status
    start
    stop
    errors
  }
}

# Get a specific test result
query {
  getTestResult(id: "result-123") {
    id
    testName
    status
    start
    stop
    errors
  }
}

Test status values: INVALID, STARTED, SUCCESSFUL, FAILED

Permission: IntegrationTestView

Mutations

Load Integration Test from YAML

Load an integration test defined in YAML format.

graphql
mutation {
  loadIntegrationTest(configYaml: """
    name: my-test
    description: Tests the basic transform pipeline
    dataSources:
      - my-source
    transformationFlows:
      - my-transform
    dataSinks:
      - my-sink
    inputs:
      - dataSource: my-source
        contentType: text/plain
        ingressFileName: test.txt
        data: Hello World
    timeout: PT60S
    expectedDeltaFiles:
      - stage: COMPLETE
        expectedFlows:
          - flow: my-transform
            type: TRANSFORM
            state: COMPLETE
  """) {
    success
    errors
  }
}

Permission: IntegrationTestUpdate

Save Integration Test

Save an integration test using the GraphQL input type.

graphql
mutation {
  saveIntegrationTest(testCase: {
    name: "my-test"
    description: "Tests the basic pipeline"
    dataSources: ["my-source"]
    transformationFlows: ["my-transform"]
    dataSinks: ["my-sink"]
    inputs: [{
      dataSource: "my-source"
      contentType: "text/plain"
      ingressFileName: "test.txt"
      data: "Hello World"
    }]
    timeout: "PT60S"
    expectedDeltaFiles: [{
      stage: COMPLETE
      expectedFlows: [{
        flow: "my-transform"
        type: TRANSFORM
        state: COMPLETE
      }]
    }]
  }) {
    success errors
  }
}

Permission: IntegrationTestUpdate

Start Integration Test

Execute a saved integration test.

graphql
mutation {
  startIntegrationTest(name: "my-test") {
    id
    testName
    status
    start
    errors
  }
}

Permission: IntegrationTestUpdate

Remove Integration Test

graphql
mutation {
  removeIntegrationTest(name: "my-test")
}

Permission: IntegrationTestDelete

Remove Test Result

graphql
mutation {
  removeTestResult(id: "result-123")
}

Permission: IntegrationTestDelete

Test Configuration Types

TestCaseIngress

Defines input data for a test.

FieldTypeDescription
dataSourceStringData source to ingest into
contentTypeStringMIME type of the test data
ingressFileNameStringFilename for the ingressed data
base64EncodedBooleanWhether data is base64-encoded
dataStringThe test data content
metadata[KeyValue]Metadata key-value pairs

ExpectedDeltaFile

Defines expected outcome for a DeltaFile.

FieldTypeDescription
stageDeltaFileStageExpected lifecycle stage
childCountIntExpected number of child DeltaFiles
parentCountIntExpected number of parent DeltaFiles
expectedFlows[ExpectedFlow]Expected flow states
expectedContentExpectedContentListExpected content data
annotationsKeyValueChecksExpected annotations
children[ExpectedDeltaFile]Expected child DeltaFile structure (nested up to 5 levels)

ExpectedFlow

FieldTypeDescription
flowStringFlow name
typeFlowTypeFlow type
stateDeltaFileFlowStateExpected flow state
actions[String]Expected action names
metadataKeyValueChecksExpected metadata checks

ExpectedContentData

FieldTypeDescription
nameStringContent name
mediaTypeStringExpected media type
contains[String]Strings the content must contain
valueStringExact expected content value
base64EncodedBooleanWhether value is base64-encoded
ignoreWhitespaceBooleanIgnore whitespace in comparison
macroSubstitutionsBooleanEnable macro substitution in expected values
extraSubstitutions[KeyValue]Additional macro substitution variables

KeyValueChecks

FieldTypeDescription
containsKeys[String]Keys that must be present
keyValueMatchers[KeyValueMatcher]Key-value pairs that must match

Contact US