mirror of
https://github.com/project-zot/zot.git
synced 2026-06-20 06:37:56 +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:
@@ -44,7 +44,7 @@ func TestSearchCommandGQL(t *testing.T) {
|
||||
|
||||
Convey("query", func() {
|
||||
args := []string{"query", "repo/al", "--config", "searchtest"}
|
||||
cmd := NewSearchCommand(mockService{})
|
||||
cmd := NewSearchCommand(newMockService())
|
||||
|
||||
buff := bytes.NewBufferString("")
|
||||
cmd.SetOut(buff)
|
||||
@@ -62,7 +62,7 @@ func TestSearchCommandGQL(t *testing.T) {
|
||||
Convey("query command errors", func() {
|
||||
// no url
|
||||
args := []string{"repo/al", "--config", "searchtest"}
|
||||
cmd := NewSearchQueryCommand(mockService{})
|
||||
cmd := NewSearchQueryCommand(newMockService())
|
||||
buff := bytes.NewBufferString("")
|
||||
cmd.SetOut(buff)
|
||||
cmd.SetErr(buff)
|
||||
@@ -76,7 +76,7 @@ func TestSearchCommandGQL(t *testing.T) {
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
args := []string{"subject", "repo:tag", "--config", "searchtest"}
|
||||
cmd := NewSearchCommand(mockService{})
|
||||
cmd := NewSearchCommand(newMockService())
|
||||
|
||||
buff := bytes.NewBufferString("")
|
||||
cmd.SetOut(buff)
|
||||
@@ -93,7 +93,7 @@ func TestSearchCommandGQL(t *testing.T) {
|
||||
Convey("subject command errors", func() {
|
||||
// no url
|
||||
args := []string{"repo:tag", "--config", "searchtest"}
|
||||
cmd := NewSearchSubjectCommand(mockService{})
|
||||
cmd := NewSearchSubjectCommand(newMockService())
|
||||
buff := bytes.NewBufferString("")
|
||||
cmd.SetOut(buff)
|
||||
cmd.SetErr(buff)
|
||||
@@ -123,7 +123,7 @@ func TestSearchCommandREST(t *testing.T) {
|
||||
|
||||
Convey("query", func() {
|
||||
args := []string{"query", "repo/al", "--config", "searchtest"}
|
||||
cmd := NewSearchCommand(mockService{})
|
||||
cmd := NewSearchCommand(newMockService())
|
||||
|
||||
buff := bytes.NewBufferString("")
|
||||
cmd.SetOut(buff)
|
||||
@@ -138,7 +138,7 @@ func TestSearchCommandREST(t *testing.T) {
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
args := []string{"subject", "repo:tag", "--config", "searchtest"}
|
||||
cmd := NewSearchCommand(mockService{})
|
||||
cmd := NewSearchCommand(newMockService())
|
||||
|
||||
buff := bytes.NewBufferString("")
|
||||
cmd.SetOut(buff)
|
||||
|
||||
Reference in New Issue
Block a user