You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrate API and plugin tests to context-aware calls
Replace nil and context.Background() with t.Context() throughout all API
and plugin test files to enable proper test timeout handling and allow Go's
test framework to clean up resources when tests are terminated or timeout.
Test improvements:
- opensearchapi: All 37 API test files migrated to t.Context()
- opensearchutil: JSON reader integration test updated
- plugins/ism: Policy and API tests migrated
- plugins/security: All 12 security plugin tests migrated
Context propagation enables proper test timeout handling, respects test
deadlines, and allows Go's test runner to perform cleanup when tests are
cancelled. This makes tests more resilient and easier to debug when they
fail or timeout.
Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
7
7
### Added
8
8
9
9
- Enhanced cluster readiness checking for improved test reliability: `ostest.NewClient()` now includes readiness validation (health + cluster state + nodes info)
10
+
- Test parallelization support via TEST_PARALLEL environment variable (default: CPU cores - 1, minimum 1)
11
+
- opensearchutil/testutil package with PollUntil helper for eventual consistency testing (ISM policies, index readiness, cluster state changes)
- Policy-based routing system for improved request routing and service availability ([#771](https://github.com/opensearch-project/opensearch-go/pull/771))
12
14
-`Policy` interface for composable routing strategies with lifecycle management
@@ -26,17 +28,34 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
26
28
- Refactor Client struct to use embedded mutex pattern for improved thread safety ([#775](https://github.com/opensearch-project/opensearch-go/pull/775))
27
29
- Refactor metrics struct to use atomic counters for lock-free request/failure tracking ([#776](https://github.com/opensearch-project/opensearch-go/pull/776))
28
30
- Test against Opensearch 2.19.4, 3.1, 3.3, and 3.4 ([#782](https://github.com/opensearch-project/opensearch-go/pull/782))
31
+
- Migrate all test files to context-aware API calls for proper timeout and cancellation support
32
+
- Add cluster readiness validation and improve cluster error diagnostics
33
+
- Update Docker cluster management to add version-aware role detection (cluster_manager vs master)
34
+
- Generate unique document IDs in tests for parallel test execution and eliminate known test flakes
35
+
- Reduce integration test timeout from 1h to 10m per package with parallel execution support
36
+
- Refactor transport code for improved maintainability (rename ErrInvalidRole -> InvalidRoleError, add response body cleanup, simplify initialization)
29
37
-**BREAKING**: Enhanced node discovery to match OpenSearch server behavior ([#765](https://github.com/opensearch-project/opensearch-go/issues/765))
30
38
- Dedicated cluster manager nodes are now excluded from client request routing by default (best practice)
31
39
- Node selection logic now matches Java client `NodeSelector.SKIP_DEDICATED_CLUSTER_MASTERS` behavior
40
+
-**BREAKING**: Add context support to discovery and client lifecycle management
41
+
-`opensearchtransport.Discoverable` interface now requires `context.Context` parameter: `DiscoverNodes(ctx context.Context) error`
42
+
-`opensearch.Client.DiscoverNodes()` and `opensearchtransport.Client.DiscoverNodes()` now require `context.Context` parameter
43
+
-`opensearch.Config` and `opensearchtransport.Config` now accept optional `Context` and `CancelFunc` fields
44
+
-`opensearchutil.BulkIndexerConfig` now accepts optional `Context` and `CancelFunc` fields
45
+
- Enables proper context propagation for timeouts, cancellation, and graceful shutdown
32
46
33
47
### Deprecated
34
48
35
49
### Removed
36
50
37
51
### Fixed
38
52
53
+
- Fix connection lifecycle bug in statusConnectionPool.OnFailure where connections were scheduled for resurrection before being moved from live to dead list, causing potential race conditions
39
54
- Fix flaky connection integration test by replacing arbitrary sleep times with proper server readiness polling
55
+
- Fix cluster readiness checks in integration tests to handle HTTPS cold start delays (increase timeout to 15s)
- Fix Docker cluster management to properly handle version-specific configurations and clean stale images/volumes
58
+
- Fix OpenSearch 2.8.0+ Tasks API compatibility by adding cancellation_time_millis field to TasksListTask struct
40
59
- Fix OpenSearch 3.1.0+ API compatibility by adding phase_results_processors field to nodes API and time_in_execution fields to cluster pending tasks API
41
60
- Fix OpenSearch 3.2.0+ API compatibility by adding max_last_index_request_timestamp and startree query fields across nodes stats, indices stats, and cat APIs, plus settings field to security plugin health API
42
61
- Fix OpenSearch 3.3.0+ API compatibility by adding neural_search breaker, query_failed and startree_query_failed search fields, search pipeline system_generated fields across multiple APIs, plus ingestion_status field to cluster state API and jwks_uri field to security config API
0 commit comments