chore: fix dependabot alerts (#3041)

* chore: fix dependabot alerts

Signed-off-by: Ramkumar Chinchani <rchincha.dev@gmail.com>

* test: fix http status code check

Related to gqlgen changes
-       github.com/99designs/gqlgen v0.17.66
+       github.com/99designs/gqlgen v0.17.68

Signed-off-by: Ramkumar Chinchani <rchincha.dev@gmail.com>

---------

Signed-off-by: Ramkumar Chinchani <rchincha.dev@gmail.com>
This commit is contained in:
Ramkumar Chinchani
2025-03-18 20:10:55 -07:00
committed by GitHub
parent f9b647beaf
commit ff50aab9b3
7 changed files with 136 additions and 153 deletions
+6 -6
View File
@@ -586,7 +586,7 @@ func TestCVESearch(t *testing.T) {
resp, _ = resty.R().SetBasicAuth(username, password).Get(baseURL + constants.FullSearchPrefix)
So(resp, ShouldNotBeNil)
So(resp.StatusCode(), ShouldEqual, 422)
So(resp.StatusCode(), ShouldEqual, 400)
var cveResult CveResult
contains := false
@@ -727,23 +727,23 @@ func TestCVESearch(t *testing.T) {
// Testing Invalid Search URL
resp, _ = resty.R().SetBasicAuth(username, password).Get(baseURL + constants.FullSearchPrefix + "?query={CVEListForImage(image:\"zot-test:0.0.1\"){Ta%20CVEList{Id%20Description%20Severity}}}")
So(resp, ShouldNotBeNil)
So(resp.StatusCode(), ShouldEqual, 422)
So(resp.StatusCode(), ShouldEqual, 400)
resp, _ = resty.R().SetBasicAuth(username, password).Get(baseURL + constants.FullSearchPrefix + "?query={ImageListForCVE(tet:\"CVE-2018-20482\"){Results{RepoName%20Tag}}}")
So(resp, ShouldNotBeNil)
So(resp.StatusCode(), ShouldEqual, 422)
So(resp.StatusCode(), ShouldEqual, 400)
resp, _ = resty.R().SetBasicAuth(username, password).Get(baseURL + constants.FullSearchPrefix + "?query={ImageistForCVE(id:\"CVE-2018-20482\"){Results{RepoName%20Tag}}}")
So(resp, ShouldNotBeNil)
So(resp.StatusCode(), ShouldEqual, 422)
So(resp.StatusCode(), ShouldEqual, 400)
resp, _ = resty.R().SetBasicAuth(username, password).Get(baseURL + constants.FullSearchPrefix + "?query={ImageListForCVE(id:\"CVE-2018-20482\"){ame%20Tags}}")
So(resp, ShouldNotBeNil)
So(resp.StatusCode(), ShouldEqual, 422)
So(resp.StatusCode(), ShouldEqual, 400)
resp, _ = resty.R().SetBasicAuth(username, password).Get(baseURL + constants.FullSearchPrefix + "?query={CVEListForImage(reo:\"zot-test:1.0.0\"){Tag%20CVEList{Id%20Description%20Severity}}}")
So(resp, ShouldNotBeNil)
So(resp.StatusCode(), ShouldEqual, 422)
So(resp.StatusCode(), ShouldEqual, 400)
resp, _ = resty.R().SetBasicAuth(username, password).Get(baseURL + constants.FullSearchPrefix + "?query={ImageListForCVE(id:\"" + cveid + "\"){Results{RepoName%20Tag}}}")
So(resp, ShouldNotBeNil)
+3 -3
View File
@@ -121,7 +121,7 @@ func TestDigestSearchHTTP(t *testing.T) {
resp, err = resty.R().Get(baseURL + constants.FullSearchPrefix)
So(resp, ShouldNotBeNil)
So(err, ShouldBeNil)
So(resp.StatusCode(), ShouldEqual, 422)
So(resp.StatusCode(), ShouldEqual, 400)
// "sha" should match all digests in all images
query := `{
@@ -249,7 +249,7 @@ func TestDigestSearchHTTP(t *testing.T) {
)
So(resp, ShouldNotBeNil)
So(err, ShouldBeNil)
So(resp.StatusCode(), ShouldEqual, 422)
So(resp.StatusCode(), ShouldEqual, 400)
err = json.Unmarshal(resp.Body(), &responseStruct)
So(err, ShouldBeNil)
@@ -305,7 +305,7 @@ func TestDigestSearchHTTPSubPaths(t *testing.T) {
resp, err = resty.R().Get(baseURL + constants.FullSearchPrefix)
So(resp, ShouldNotBeNil)
So(err, ShouldBeNil)
So(resp.StatusCode(), ShouldEqual, 422)
So(resp.StatusCode(), ShouldEqual, 400)
query := `{
ImageListForDigest(id:"sha") {
@@ -13716,9 +13716,7 @@ func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Conte
func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v any) ([]string, error) {
var vSlice []any
if v != nil {
vSlice = graphql.CoerceList(v)
}
vSlice = graphql.CoerceList(v)
var err error
res := make([]string, len(vSlice))
for i := range vSlice {
@@ -14499,9 +14497,7 @@ func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v
return nil, nil
}
var vSlice []any
if v != nil {
vSlice = graphql.CoerceList(v)
}
vSlice = graphql.CoerceList(v)
var err error
res := make([]string, len(vSlice))
for i := range vSlice {
@@ -14537,9 +14533,7 @@ func (ec *executionContext) unmarshalOString2ᚕᚖstring(ctx context.Context, v
return nil, nil
}
var vSlice []any
if v != nil {
vSlice = graphql.CoerceList(v)
}
vSlice = graphql.CoerceList(v)
var err error
res := make([]*string, len(vSlice))
for i := range vSlice {
+1 -1
View File
@@ -2,7 +2,7 @@ package search
// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
// Code generated by github.com/99designs/gqlgen version v0.17.66
// Code generated by github.com/99designs/gqlgen version v0.17.68
import (
"context"
+5 -5
View File
@@ -401,7 +401,7 @@ func TestRepoListWithNewestImage(t *testing.T) {
resp, err = resty.R().Get(baseURL + graphqlQueryPrefix)
So(resp, ShouldNotBeNil)
So(err, ShouldBeNil)
So(resp.StatusCode(), ShouldEqual, 422)
So(resp.StatusCode(), ShouldEqual, 400)
Convey("Test repoListWithNewestImage with pagination", func() {
query := `{
@@ -725,7 +725,7 @@ func TestRepoListWithNewestImage(t *testing.T) {
resp, err := resty.R().Get(baseURL + graphqlQueryPrefix)
So(resp, ShouldNotBeNil)
So(err, ShouldBeNil)
So(resp.StatusCode(), ShouldEqual, 422)
So(resp.StatusCode(), ShouldEqual, 400)
uploadedImage := CreateDefaultImage()
@@ -1291,7 +1291,7 @@ func TestExpandedRepoInfo(t *testing.T) {
resp, err = resty.R().Get(baseURL + graphqlQueryPrefix)
So(resp, ShouldNotBeNil)
So(err, ShouldBeNil)
So(resp.StatusCode(), ShouldEqual, 422)
So(resp.StatusCode(), ShouldEqual, 400)
query := `{
ExpandedRepoInfo(repo:"zot-cve-test"){
@@ -1576,7 +1576,7 @@ func TestExpandedRepoInfo(t *testing.T) {
resp, err = resty.R().Get(baseURL + graphqlQueryPrefix)
So(resp, ShouldNotBeNil)
So(err, ShouldBeNil)
So(resp.StatusCode(), ShouldEqual, 422)
So(resp.StatusCode(), ShouldEqual, 400)
// create test images
repoName := "test-repo" //nolint:goconst
@@ -1809,7 +1809,7 @@ func TestExpandedRepoInfo(t *testing.T) {
resp, err = resty.R().Get(baseURL + graphqlQueryPrefix)
So(resp, ShouldNotBeNil)
So(err, ShouldBeNil)
So(resp.StatusCode(), ShouldEqual, 422)
So(resp.StatusCode(), ShouldEqual, 400)
query := `{
ExpandedRepoInfo(repo:"zot-cve-test"){