mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 21:17:58 +08:00
refactor: enhance TLS cert generation and refactor HTTP client architecture (#3638)
- Refactored HTTP client from global cache to struct-based approach (global state was shared between tests, including what certificates to use) - Enhanced pkg/test/tls to support ECDSA and ED25519 key types - Replaced static certificate files with dynamic generation in golang tests - Fixed test cleanup issues and improved resource management This eliminates dependency on external cert generation scripts and improves test maintainability. Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>
This commit is contained in:
@@ -112,15 +112,17 @@ func TestServerStatusCommandErrors(t *testing.T) {
|
||||
|
||||
// invalid URL
|
||||
err = GetServerStatus(SearchConfig{
|
||||
ServURL: "a: ds",
|
||||
ResultWriter: os.Stdout,
|
||||
ServURL: "a: ds",
|
||||
ResultWriter: os.Stdout,
|
||||
SearchService: NewSearchService(),
|
||||
})
|
||||
So(err, ShouldNotBeNil)
|
||||
|
||||
// fail Get request
|
||||
err = GetServerStatus(SearchConfig{
|
||||
ServURL: "http://127.0.0.1:8000",
|
||||
ResultWriter: os.Stdout,
|
||||
ServURL: "http://127.0.0.1:8000",
|
||||
ResultWriter: os.Stdout,
|
||||
SearchService: NewSearchService(),
|
||||
})
|
||||
So(err, ShouldBeNil)
|
||||
})
|
||||
@@ -129,7 +131,7 @@ func TestServerStatusCommandErrors(t *testing.T) {
|
||||
port := test.GetFreePort()
|
||||
result := bytes.NewBuffer([]byte{})
|
||||
searchConfig := SearchConfig{
|
||||
SearchService: mockService{},
|
||||
SearchService: newMockService(),
|
||||
ServURL: fmt.Sprintf("http://127.0.0.1:%v", port),
|
||||
User: "",
|
||||
OutputFormat: "text",
|
||||
|
||||
Reference in New Issue
Block a user