Problem description found by a community member:
Something interesting came up while testing the SDK. I have a test class with two tests. One for basic connection and another with SSL connection to execute a simple tso command. When I ran all the tests Basic test runs fine but SSL one fails with 401. But when I run SSL test alone it runs fine.
Root cause:
The SDK uses a global Unirest instance that is shared. Because Unirest.config() is global, your tests are not isolated.
The issue was resolved by introducing a dedicated UnirestInstance for each connection type, allowing HTTP configuration and state to remain isolated and reusable.
BasicConnection
|
+-- UnirestInstance
SslConnection
|
+-- UnirestInstance
Each connection owns its HTTP state.global
Each connection now owns its own HTTP client state rather than sharing a global mutable Unirest instance.
This architectural change was implemented in the 7.0.1 release, eliminating the shared mutable Unirest instance and resolving the test isolation issue.
Problem description found by a community member:
Something interesting came up while testing the SDK. I have a test class with two tests. One for basic connection and another with SSL connection to execute a simple tso command. When I ran all the tests Basic test runs fine but SSL one fails with 401. But when I run SSL test alone it runs fine.
Root cause:
The SDK uses a global Unirest instance that is shared. Because Unirest.config() is global, your tests are not isolated.
The issue was resolved by introducing a dedicated UnirestInstance for each connection type, allowing HTTP configuration and state to remain isolated and reusable.
BasicConnection
|
+-- UnirestInstance
SslConnection
|
+-- UnirestInstance
Each connection owns its HTTP state.global
Each connection now owns its own HTTP client state rather than sharing a global mutable Unirest instance.
This architectural change was implemented in the 7.0.1 release, eliminating the shared mutable Unirest instance and resolving the test isolation issue.