Skip to main content
Version: Next

CLAUDE.md

Java SDK V2 integration tests - guidance for Claude Code.

Running Integration Tests

Prerequisites: Running DataHub instance (start with ./gradlew quickstartDebug)

# Run all integration tests
ADMIN_USERNAME=datahub ADMIN_PASSWORD=datahub ./gradlew :metadata-integration:java:datahub-client:test --tests "*Integration*"

# Run specific entity tests
./gradlew :metadata-integration:java:datahub-client:test --tests "DatasetIntegrationTest"

# Run single test method
./gradlew :metadata-integration:java:datahub-client:test --tests "DatasetIntegrationTest.testDatasetCreateMinimal"

# With verbose output
./gradlew :metadata-integration:java:datahub-client:test --tests "*Integration*" --info

Environment Variables

VariableRequiredDefaultDescription
DATAHUB_SERVERYeshttp://localhost:8080DataHub GMS server URL
DATAHUB_TOKENNoauto-generatedPersonal access token (skips auth if provided)
ADMIN_USERNAMENodatahubAdmin username for authentication
ADMIN_PASSWORDNodatahubAdmin password for authentication

Note: BaseIntegrationTest automatically generates tokens from admin credentials if DATAHUB_TOKEN not provided.

Test Organization

80 integration tests across 8 entity types (Dataset, Chart, Dashboard, DataJob, DataFlow, Container, MLModel, MLModelGroup).

All tests extend BaseIntegrationTest which handles authentication, token generation, client initialization, and cleanup.

Adding New Integration Tests

public class MyEntityIntegrationTest extends BaseIntegrationTest {
@Test
public void testMyEntity() throws Exception {
// Use inherited 'client' field
MyEntity entity = MyEntity.builder()
.id("test_entity_" + System.currentTimeMillis()) // Use timestamps for unique IDs
.build();
client.entities().upsert(entity);
assertNotNull(entity.getUrn());
}
}

Important: Use timestamp-based IDs to avoid conflicts. No cleanup needed - BaseIntegrationTest handles lifecycle.

Troubleshooting

Tests skipped: Verify DataHub running and environment set:

curl http://localhost:8080/health
export DATAHUB_SERVER=http://localhost:8080

Authentication failures: Check credentials:

export ADMIN_USERNAME=datahub
export ADMIN_PASSWORD=datahub

Connection issues: Check services:

docker ps | grep datahub
curl http://localhost:8080/health
docker logs datahub-gms # View GMS logs