This directory contains comprehensive end-to-end tests for the Directory system, organized into separate packages by deployment mode and API type for better isolation and maintainability.
Structure: 3 separate test suites with 103+ test cases organized by deployment mode and API type
e2e/
├── shared/ # package shared - Common utilities
│ ├── config/ # Deployment mode configuration
│ ├── utils/ # CLI helpers, validation utilities
│ └── testdata/ # Test record files with embedding
├── local/ # package local - CLI tests (local mode)
│ ├── local_suite_test.go # TestLocalE2E(t *testing.T)
│ ├── 01_storage_test.go # Storage operations
│ ├── 02_search_test.go # Search functionality
│ ├── 03_routing_test.go # Local routing operations
│ ├── 04_signature_test.go # Signature workflows
│ └── 05_network_cmd_test.go # Network command utilities
├── client/ # package client - Go library tests (local mode)
│ ├── client_suite_test.go # TestClientE2E(t *testing.T)
│ └── 01_client_test.go # Client library APIs
└── network/ # package network - CLI tests (network mode)
├── network_suite_test.go # TestNetworkE2E(t *testing.T)
├── cleanup.go # Inter-test cleanup utilities
├── 01_deploy_test.go # Multi-peer deployment
├── 02_sync_test.go # Peer synchronization
└── 03_search_test.go # Remote routing search
Deployment: Local single node
Focus: CLI commands in local deployment mode
Suite: TestLocalE2E(t *testing.T)
Focus: Core CLI commands with OASF version compatibility
Test Cases:
should successfully push a record- Testsdirctl pushwith 0.3.1/0.7.0 record formatsshould successfully pull an existing record- Testsdirctl pullfunctionalityshould return identical record when pulled after push- Validates data integrity across push/pull cycleshould push the same record again and return the same cid- Tests CID determinismshould search for records with first skill and return their CID- Tests general search API (searchv1) with skill queriesshould search for records with second skill and return their CID- Validates all skills are preserved during storageshould pull a non-existent record and return an error- Tests error handling for missing recordsshould successfully delete a record- Testsdirctl deletefunctionalityshould fail to pull a deleted record- Validates deletion actually removes records
Key Features:
- OASF version compatibility (0.3.1, 0.7.0)
- JSON data integrity validation
- CID determinism testing
- General search API testing (searchv1, not routing)
Focus: Advanced search patterns and wildcard support
Test Cases:
- Exact match searches (no wildcards)
- Wildcard searches with
*pattern (name, version, skill, locator, module fields) - Wildcard searches with
?pattern (single character matching) - Wildcard searches with
[]list patterns (character classes and ranges) - Mixed wildcard patterns and complex combinations
- Negative tests for non-matching patterns
- Edge cases and special characters
Key Features:
- Comprehensive wildcard pattern testing
- Complex search query validation
- Pattern matching edge cases
- Error handling for invalid patterns
Focus: Complete routing subcommand testing in local environment
Test Cases:
should push a record first (prerequisite for publish)- Setup record for routing testsshould publish a record to local routing- Testsdirctl routing publishin local modeshould fail to publish non-existent record- Tests publish error handlingshould list all local records without filters- Testsdirctl routing listwithout filtersshould list record by CID- Testsdirctl routing list --cidfunctionalityshould list records by skill filter- Testsdirctl routing list --skillwith hierarchical matchingshould list records by specific skill- Tests specific skill matchingshould list records by locator filter- Testsdirctl routing list --locatorfunctionalityshould list records with multiple filters (AND logic)- Tests multiple filter combinationshould return empty results for non-matching skill- Tests filtering with no resultsshould return empty results for non-existent CID- Tests CID lookup with helpful messagesshould respect limit parameter- Testsdirctl routing list --limitfunctionalityshould search for local records (but return empty in local mode)- Testsdirctl routing searchin local modeshould handle search with multiple criteria- Tests complex search queries in local modeshould provide helpful guidance when no remote records found- Tests search guidance messagesshould show routing statistics for local records- Testsdirctl routing infocommandshould show helpful tips in routing info- Tests info command guidanceshould unpublish a previously published record- Testsdirctl routing unpublishcommandshould fail to unpublish non-existent record- Tests unpublish error handlingshould not find unpublished record in local list- Validates unpublish removes from routingshould show empty routing info after unpublish- Tests info after unpublishshould validate routing command help- Testsdirctl routing --helpfunctionality
Key Features:
- Complete routing subcommand coverage
- Local-only routing behavior validation
- Error handling and edge cases
- Command integration testing
- Help and guidance message validation
Focus: Record signing, verification, and cryptographic operations
Test Cases:
should create keys for signing- Tests key generation for signingshould push a record to the store- Setup record for signing testsshould sign a record with a key pair- Testsdirctl signcommandshould verify a signature with a public key on server side- Tests server-side signature verificationshould pull a signature from the store- Tests signature retrievalshould pull a public key from the store- Tests public key retrieval
Key Features:
- Cryptographic signing workflows
- Key management testing
- Signature verification validation
Focus: Network-specific CLI utilities and key management (local mode)
Test Cases:
should generate a peer ID from a valid ED25519 key- Testsnetwork infowith existing keyshould fail with non-existent key file- Tests error handling for missing keysshould fail with empty key path- Tests validation of key path parametershould generate a new peer ID and save the key to specified output- Testsnetwork initkey generationshould fail when output directory doesn't exist and cannot be created- Tests error handling for invalid paths
Key Features:
- Network identity management
- Key generation and validation
- CLI utility testing
Deployment: Local single node
Focus: Go client library API methods
Suite: TestClientE2E(t *testing.T)
Focus: Client library API methods with OASF version compatibility
Test Cases:
should push a record to store- Testsc.Push()client methodshould pull a record from store- Testsc.Pull()client methodshould publish a record- Testsc.Publish()routing methodshould list published record by one label- Testsc.List()with single queryshould list published record by multiple labels- Testsc.List()with multiple queries (AND logic)should list published record by feature and domain labels- Tests domain/feature support (currently skipped)should search routing for remote records- Testsc.SearchRouting()methodshould unpublish a record- Testsc.Unpublish()routing methodshould not find unpublished record- Validates unpublish removes routing announcementsshould delete a record from store- Testsc.Delete()storage methodshould not find deleted record in store- Validates delete removes from storage
Key Features:
- Direct client library API testing
- Routing API validation (publish, list, unpublish, search)
- OASF version compatibility (0.3.1, 0.7.0)
- RecordQuery API testing
Deployment: Network with multiple peers
Focus: CLI commands in network deployment mode with proper test isolation
Suite: TestNetworkE2E(t *testing.T)
Focus: Multi-peer routing, DHT operations, local vs remote behavior
Test Cases:
should push record_v070.json to peer 1- Tests storage on specific peershould pull record_v070.json from peer 1- Tests local retrievalshould fail to pull record_v070.json from peer 2- Validates records are peer-specificshould publish record_v070.json to the network on peer 1- Tests DHT announcementshould fail publish record_v070.json to the network on peer 2- Tests publish validationshould list local records correctly (List is local-only)- Tests local-only list behaviorshould list by skill correctly on local vs remote peers- Validates local vs remote filteringshould show routing info statistics- Tests routing statistics commandshould discover remote records via routing search- Tests network-wide discovery
Key Features:
- Multi-peer DHT testing
- Local vs remote record validation
- Network announcement and discovery
- Complete routing subcommand testing
- Cleanup:
DeferCleanupensures clean state for subsequent tests
Focus: Sync service operations, peer-to-peer data replication
Test Cases:
should accept valid remote URL format- Tests sync creation with remote URLsshould execute without arguments and return a list with the created sync- Testssync listcommandshould accept a sync ID argument and return the sync status- Testssync statuscommandshould accept a sync ID argument and delete the sync- Testssync deletecommandshould return deleted status- Validates sync deletionshould push record_v070_sync_v4.json to peer 1- Setup for sync testingshould publish record_v070_sync_v4.json- Tests routing publish for sync recordsshould push record_v070_sync_v5.json to peer 1- Setup second record for multi-peer syncshould publish record_v070_sync_v5.json- Tests routing publish for second recordshould fail to pull record_v070_sync_v4.json from peer 2- Validates initial isolationshould create sync from peer 1 to peer 2- Tests sync creation between peersshould list the sync- Tests sync listing on target peershould wait for sync to complete- Tests sync completion monitoringshould succeed to pull record_v070_sync_v4.json from peer 2 after sync- Validates sync transferred datashould succeed to search for record_v070_sync_v4.json from peer 2 after sync- Tests search after syncshould verify the record_v070_sync_v4.json from peer 2 after sync- Tests verification after syncshould delete sync from peer 2- Tests sync cleanupshould wait for delete to complete- Tests sync deletion completionshould create sync from peer 1 to peer 3 using routing search piped to sync create- Tests advanced sync creation with routing searchshould wait for sync to complete- Tests sync completion for peer 3should succeed to pull record_v070_sync_v5.json from peer 3 after sync- Validates selective sync (Audio skill)should fail to pull record_v070_sync_v4.json from peer 3 after sync- Validates sync filtering by skills
Key Features:
- Peer-to-peer synchronization testing
- Sync lifecycle management
- Data replication validation
- Multi-peer sync scenarios (peer 1 → peer 2, peer 1 → peer 3)
- Selective sync based on routing search and skill filtering
- Uses general search API (searchv1, not routing)
- Cleanup:
DeferCleanupensures clean state for subsequent tests
Focus: Remote routing search functionality with OR logic and minMatchScore
Test Cases:
should push record_v070.json to peer 1- Setup record for search testsshould publish record_v070.json to routing on peer 1 only- Creates remote search scenarioshould verify setup - peer 1 has local record, peer 2 does not- Validates test setupshould debug: test working pattern first (minScore=1)- Tests basic search functionalityshould debug: test exact skill matching (minScore=1)- Tests exact skill searchesshould debug: test two skills with minScore=2- Tests multiple skill matchingshould demonstrate OR logic success - minScore=2 finds record- Tests OR logic with partial matchesshould demonstrate threshold filtering - minScore=3 filters out record- Tests score thresholdsshould demonstrate single query match - minScore=1 finds record- Tests single query scenariosshould demonstrate all queries match - minScore=2 with 2 real queries- Tests complete matchesshould handle minScore=0 (should default to minScore=1)- Tests edge case handlingshould handle empty queries with appropriate error- Tests error handling
Key Features:
- Remote routing search testing (routingv1)
- OR logic and minMatchScore validation
- DHT discovery testing
- Complex search query scenarios
- Cleanup:
DeferCleanupensures clean state after all tests
Focus: Shared cleanup utilities for network test isolation
Functions:
CleanupNetworkRecords()- Removes CIDs from all peers (unpublish + delete)RegisterCIDForCleanup()- Tracks CIDs for cleanup by test fileCleanupAllNetworkTests()- Comprehensive cleanup for AfterSuite
Key Features:
- Solves test contamination: Ensures clean state between test files
- Multi-peer cleanup: Removes records from all peers (Peer1, Peer2, Peer3)
- Dual operations: Both unpublish (routing) and delete (storage)
- Graceful handling: Continues cleanup even if individual operations fail
# Run all e2e tests (client → local CLI → network CLI)
task test:e2e
task e2e# Run local tests (client library + CLI with shared infrastructure)
task test:e2e:local
task e2e:local
# Run individual test suites (with dedicated infrastructure)
task test:e2e:client # Client library tests only
task test:e2e:local:cli # Local CLI tests only# Run network tests (multi-peer CLI with proper cleanup)
task test:e2e:network
task e2e:networktask test:e2e:local:
├── 🏗️ Setup local Kubernetes (single node)
├── 🔗 Setup port-forwarding
├── 📚 Run client library tests (Go APIs)
├── ⚙️ Run local CLI tests (dirctl commands)
└── 🧹 Cleanup infrastructure
task test:e2e:network:
├── 🏗️ Setup network Kubernetes (multi-peer)
├── 🔗 Setup port-forwarding
├── 🚀 Run 01_deploy_test.go → DeferCleanup → Clean all peers
├── 🔄 Run 02_sync_test.go → DeferCleanup → Clean all peers
├── 🔍 Run 03_search_test.go → DeferCleanup → Clean all peers
└── 🧹 Cleanup infrastructure
- Local vs Network: Separate Go packages prevent cross-contamination
- CLI vs Client: Different test suites for different API types
- Inter-test cleanup: Network tests clean up between files using
cleanup.go
- Focused packages: Each package has clear responsibility
- Numbered files: Predictable execution order within packages
- Shared utilities: Common code in
shared/package - Clean architecture: Logical separation of concerns
- Shared infrastructure: Local tests share single deployment
- Parallel capability: Different packages can run independently
- Efficient cleanup: Targeted cleanup only where needed
- 103+ test cases across all major functionality
- OASF version compatibility (0.3.1, 0.7.0)
- Both API types - Client library and CLI commands
- Error handling - Validation of failure scenarios
- Integration testing - Multi-step workflows
- General Search (searchv1) - Tested in
local/01_storage_test.goandnetwork/02_sync_test.go - Routing Search (routingv1) - Tested in
client/01_client_test.go,local/03_routing_test.go, andnetwork/tests - Network Discovery - Multi-peer search scenarios in
network/03_search_test.go - Wildcard Patterns - Comprehensive pattern testing in
local/02_search_test.go
- Complete lifecycle - Publish → List → Search → Unpublish
- Local vs Remote - Clear distinction and validation in network tests
- Statistics - Routing info and summary data
- Error scenarios - Comprehensive failure case testing
- Test Isolation - Proper cleanup between network test files
- Package separation - True isolation between deployment modes
- API type separation - CLI tests vs Go library tests in separate packages
- Controlled execution - Numbered files ensure predictable test order
- Efficient infrastructure - Shared deployment for compatible test suites
- Robust cleanup - Inter-test cleanup prevents contamination
# Fast feedback during development
task test:e2e:client # Test Go library changes
# Full local testing
task test:e2e:local # Test both client and CLI# Test specific network functionality
task test:e2e:network # Test multi-peer scenarios with proper cleanup# Run individual test files (with Ginkgo focus)
go test -C ./e2e/network . -ginkgo.focus="Deploy"
go test -C ./e2e/local . -ginkgo.focus="Storage"