0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00

go.mod: update modules

This commit is contained in:
Ramkumar Chinchani 2021-05-21 20:47:28 +00:00 committed by Ramkumar Chinchani
parent c6670b1329
commit 26926ad4c2
10 changed files with 510 additions and 214 deletions

View file

@ -17,7 +17,7 @@ jobs:
- name: Install go
uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.16.x
- name: Check out source code
uses: actions/checkout@v1
@ -33,6 +33,7 @@ jobs:
sudo snap install skopeo --edge --devmode
- name: Run build and test
timeout-minutes: 30
run: |
cd $GITHUB_WORKSPACE && make

50
go.mod
View file

@ -1,48 +1,46 @@
module github.com/anuvu/zot
go 1.14
go 1.16
require (
github.com/99designs/gqlgen v0.12.2
github.com/Microsoft/hcsshim v0.8.16 // indirect
github.com/Microsoft/hcsshim v0.8.17 // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/apex/log v1.4.0
github.com/apex/log v1.9.0
github.com/aquasecurity/trivy v0.0.0-00010101000000-000000000000
github.com/briandowns/spinner v1.11.1
github.com/chartmuseum/auth v0.4.0
github.com/briandowns/spinner v1.12.0
github.com/chartmuseum/auth v0.4.5
github.com/dustin/go-humanize v1.0.0
github.com/getlantern/deepcopy v0.0.0-20160317154340-7f45deb8130a
github.com/go-chi/chi v4.0.2+incompatible // indirect
github.com/go-ldap/ldap/v3 v3.1.3
github.com/gofrs/uuid v3.2.0+incompatible
github.com/google/go-containerregistry v0.0.0-20200331213917-3d03ed9b1ca2
github.com/gorilla/handlers v1.4.2
github.com/gorilla/mux v1.7.4
github.com/go-ldap/ldap/v3 v3.3.0
github.com/gofrs/uuid v4.0.0+incompatible
github.com/google/go-containerregistry v0.6.0
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/json-iterator/go v1.1.10
github.com/klauspost/compress v1.11.13 // indirect
github.com/json-iterator/go v1.1.11
github.com/klauspost/pgzip v1.2.5 // indirect
github.com/libopenstorage/openstorage v8.0.0+incompatible
github.com/mitchellh/mapstructure v1.1.2
github.com/mitchellh/mapstructure v1.4.1
github.com/moby/sys/mount v0.2.0 // indirect
github.com/nmcclain/asn1-ber v0.0.0-20170104154839-2661553a0484 // indirect
github.com/nmcclain/ldap v0.0.0-20191021200707-3b3b69a7e9e3
github.com/olekukonko/tablewriter v0.0.4
github.com/opencontainers/distribution-spec v1.0.0-rc0
github.com/olekukonko/tablewriter v0.0.5
github.com/opencontainers/distribution-spec/specs-go v0.0.0-20210810194746-13fa739db32c
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6
github.com/opencontainers/umoci v0.4.7-0.20200704224433-977db481b72c
github.com/opencontainers/runc v1.0.0-rc95 // indirect
github.com/opencontainers/umoci v0.4.7
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/rs/zerolog v1.17.2
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/rs/zerolog v1.22.0
github.com/smartystreets/goconvey v1.6.4
github.com/spf13/cobra v0.0.5
github.com/spf13/viper v1.6.1
github.com/spf13/cobra v1.2.1
github.com/spf13/viper v1.8.1
github.com/stretchr/testify v1.7.0
github.com/swaggo/http-swagger v0.0.0-20190614090009-c2865af9083e
github.com/swaggo/swag v1.6.3
github.com/vektah/gqlparser/v2 v2.0.1
github.com/swaggo/http-swagger v1.0.0
github.com/swaggo/swag v1.7.0
github.com/vektah/gqlparser/v2 v2.2.0
go.etcd.io/bbolt v1.3.5
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a
gopkg.in/resty.v1 v1.12.0
gopkg.in/yaml.v2 v2.4.0
)

540
go.sum

File diff suppressed because it is too large Load diff

View file

@ -16,4 +16,4 @@ linters-settings:
threshold: 200
nestif:
# their are various nested if else, therefore specifying complexity as 26
min-complexity: 26
min-complexity: 26

View file

@ -5,10 +5,9 @@ import (
ext "github.com/anuvu/zot/pkg/extensions"
"github.com/anuvu/zot/pkg/log"
"github.com/getlantern/deepcopy"
dspec "github.com/opencontainers/distribution-spec"
distspec "github.com/opencontainers/distribution-spec/specs-go"
)
// Global vars...
var (
Commit string // nolint: gochecknoglobals
BinaryType string // nolint: gochecknoglobals
@ -92,7 +91,7 @@ type Config struct {
func NewConfig() *Config {
return &Config{
Version: dspec.Version,
Version: distspec.Version,
Commit: Commit,
BinaryType: BinaryType,
Storage: GlobalStorageConfig{GC: true, Dedupe: true},

View file

@ -127,7 +127,7 @@ func TestTLSWithAuth(t *testing.T) {
imageCmd := NewImageCommand(new(searchService))
imageBuff := bytes.NewBufferString("")
imageCmd.SetOut(imageBuff)
imageCmd.SetErr(ioutil.Discard)
imageCmd.SetErr(imageBuff)
imageCmd.SetArgs(args)
err := imageCmd.Execute()
So(err, ShouldNotBeNil)
@ -141,7 +141,7 @@ func TestTLSWithAuth(t *testing.T) {
imageCmd = NewImageCommand(new(searchService))
imageBuff = bytes.NewBufferString("")
imageCmd.SetOut(imageBuff)
imageCmd.SetErr(ioutil.Discard)
imageCmd.SetErr(imageBuff)
imageCmd.SetArgs(args)
err = imageCmd.Execute()
So(err, ShouldNotBeNil)
@ -156,7 +156,7 @@ func TestTLSWithAuth(t *testing.T) {
imageCmd = NewImageCommand(new(searchService))
imageBuff = bytes.NewBufferString("")
imageCmd.SetOut(imageBuff)
imageCmd.SetErr(ioutil.Discard)
imageCmd.SetErr(imageBuff)
imageCmd.SetArgs(args)
err = imageCmd.Execute()
So(err, ShouldBeNil)
@ -226,7 +226,7 @@ func TestTLSWithoutAuth(t *testing.T) {
imageCmd := NewImageCommand(new(searchService))
imageBuff := bytes.NewBufferString("")
imageCmd.SetOut(imageBuff)
imageCmd.SetErr(ioutil.Discard)
imageCmd.SetErr(imageBuff)
imageCmd.SetArgs(args)
err := imageCmd.Execute()
So(err, ShouldBeNil)
@ -287,7 +287,7 @@ func TestTLSWithoutAuth(t *testing.T) {
imageCmd := NewImageCommand(new(searchService))
imageBuff := bytes.NewBufferString("")
imageCmd.SetOut(imageBuff)
imageCmd.SetErr(ioutil.Discard)
imageCmd.SetErr(imageBuff)
imageCmd.SetArgs(args)
err := imageCmd.Execute()
So(err, ShouldBeNil)
@ -350,7 +350,7 @@ func TestTLSBadCerts(t *testing.T) {
imageCmd := NewImageCommand(new(searchService))
imageBuff := bytes.NewBufferString("")
imageCmd.SetOut(imageBuff)
imageCmd.SetErr(ioutil.Discard)
imageCmd.SetErr(imageBuff)
imageCmd.SetArgs(args)
err := imageCmd.Execute()
So(err, ShouldNotBeNil)

View file

@ -4,6 +4,7 @@ package cli //nolint:testpackage
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"strings"
@ -22,7 +23,7 @@ func TestConfigCmdBasics(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(buff.String(), ShouldContainSubstring, "Usage")
@ -34,7 +35,7 @@ func TestConfigCmdBasics(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(buff.String(), ShouldContainSubstring, "Usage")
@ -49,7 +50,7 @@ func TestConfigCmdBasics(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(buff.String(), ShouldContainSubstring, "Usage")
@ -65,7 +66,7 @@ func TestConfigCmdMain(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
_ = cmd.Execute()
@ -85,7 +86,7 @@ func TestConfigCmdMain(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(err, ShouldNotBeNil)
@ -99,7 +100,7 @@ func TestConfigCmdMain(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(buff.String(), ShouldContainSubstring, "https://test-url.com")
@ -112,7 +113,7 @@ func TestConfigCmdMain(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(buff.String(), ShouldContainSubstring, "https://test-url.com")
@ -126,7 +127,7 @@ func TestConfigCmdMain(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(err, ShouldBeNil)
@ -141,7 +142,7 @@ func TestConfigCmdMain(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(buff.String(), ShouldContainSubstring, "url = https://test-url.com")
@ -155,7 +156,7 @@ func TestConfigCmdMain(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(buff.String(), ShouldContainSubstring, "url = https://test-url.com")
@ -170,7 +171,7 @@ func TestConfigCmdMain(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(err, ShouldBeNil)
@ -185,7 +186,7 @@ func TestConfigCmdMain(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(buff.String(), ShouldEqual, "https://test-url.com\n")
@ -202,6 +203,8 @@ func TestConfigCmdMain(t *testing.T) {
cmd.SetArgs(args)
err := cmd.Execute()
So(err, ShouldNotBeNil)
fmt.Println(err)
fmt.Println(buff.String())
So(buff.String(), ShouldContainSubstring, "does not exist")
})
})
@ -213,7 +216,7 @@ func TestConfigCmdMain(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(err, ShouldBeNil)
@ -234,10 +237,12 @@ func TestConfigCmdMain(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(err, ShouldNotBeNil)
fmt.Println(err)
fmt.Println(buff.String())
So(buff.String(), ShouldContainSubstring, "does not exist")
})
})
@ -249,7 +254,7 @@ func TestConfigCmdMain(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(err, ShouldBeNil)
@ -272,7 +277,7 @@ func TestConfigCmdMain(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(err, ShouldBeNil)
@ -294,7 +299,7 @@ func TestConfigCmdMain(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(err, ShouldNotBeNil)
@ -308,7 +313,7 @@ func TestConfigCmdMain(t *testing.T) {
cmd := NewConfigCommand()
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(err, ShouldNotBeNil)

View file

@ -30,7 +30,7 @@ func TestSearchCVECmd(t *testing.T) {
cmd := NewCveCommand(new(mockService))
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(buff.String(), ShouldContainSubstring, "Usage")
@ -42,7 +42,7 @@ func TestSearchCVECmd(t *testing.T) {
cmd := NewCveCommand(new(mockService))
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(buff.String(), ShouldContainSubstring, "Usage")
@ -56,7 +56,7 @@ func TestSearchCVECmd(t *testing.T) {
cmd := NewCveCommand(new(mockService))
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(err, ShouldNotBeNil)
@ -70,7 +70,7 @@ func TestSearchCVECmd(t *testing.T) {
cmd := NewCveCommand(new(mockService))
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(err, ShouldEqual, zotErrors.ErrInvalidFlagsCombination)
@ -141,7 +141,7 @@ func TestSearchCVECmd(t *testing.T) {
cmd := NewCveCommand(new(mockService))
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -157,7 +157,7 @@ func TestSearchCVECmd(t *testing.T) {
cveCmd := NewCveCommand(new(mockService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err := cveCmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -171,7 +171,7 @@ func TestSearchCVECmd(t *testing.T) {
defer os.Remove(configPath)
cveCmd := NewCveCommand(new(mockService))
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err := cveCmd.Execute()
@ -189,7 +189,7 @@ func TestSearchCVECmd(t *testing.T) {
cveCmd := NewCveCommand(new(mockService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err := cveCmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -204,7 +204,7 @@ func TestSearchCVECmd(t *testing.T) {
cveCmd := NewCveCommand(new(mockService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err := cveCmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -223,7 +223,7 @@ func TestSearchCVECmd(t *testing.T) {
cveCmd := NewCveCommand(new(mockService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err := cveCmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -240,7 +240,7 @@ func TestSearchCVECmd(t *testing.T) {
cveCmd := NewCveCommand(new(mockService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err := cveCmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -257,7 +257,7 @@ func TestSearchCVECmd(t *testing.T) {
cveCmd := NewCveCommand(new(mockService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err := cveCmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -273,7 +273,7 @@ func TestSearchCVECmd(t *testing.T) {
cveCmd := NewCveCommand(new(mockService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err := cveCmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -343,7 +343,7 @@ func TestServerCVEResponse(t *testing.T) {
cveCmd := NewCveCommand(new(searchService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err = cveCmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -359,7 +359,7 @@ func TestServerCVEResponse(t *testing.T) {
cveCmd := NewCveCommand(new(searchService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err = cveCmd.Execute()
So(err, ShouldNotBeNil)
@ -373,7 +373,7 @@ func TestServerCVEResponse(t *testing.T) {
cveCmd := NewCveCommand(new(searchService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err := cveCmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -388,7 +388,7 @@ func TestServerCVEResponse(t *testing.T) {
cveCmd := NewCveCommand(new(searchService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err := cveCmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -406,7 +406,7 @@ func TestServerCVEResponse(t *testing.T) {
cveCmd := NewCveCommand(new(searchService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err := cveCmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -421,7 +421,7 @@ func TestServerCVEResponse(t *testing.T) {
cveCmd := NewCveCommand(new(searchService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err := cveCmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -438,7 +438,7 @@ func TestServerCVEResponse(t *testing.T) {
cveCmd := NewCveCommand(new(searchService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err := cveCmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -456,7 +456,7 @@ func TestServerCVEResponse(t *testing.T) {
cveCmd := NewCveCommand(new(searchService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err := cveCmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -470,7 +470,7 @@ func TestServerCVEResponse(t *testing.T) {
cveCmd := NewCveCommand(new(searchService))
buff := bytes.NewBufferString("")
cveCmd.SetOut(buff)
cveCmd.SetErr(ioutil.Discard)
cveCmd.SetErr(buff)
cveCmd.SetArgs(args)
err := cveCmd.Execute()
space := regexp.MustCompile(`\s+`)

View file

@ -54,7 +54,7 @@ func TestSearchImageCmd(t *testing.T) {
cmd := NewImageCommand(new(mockService))
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(buff.String(), ShouldContainSubstring, "Usage")
@ -66,7 +66,7 @@ func TestSearchImageCmd(t *testing.T) {
cmd := NewImageCommand(new(mockService))
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(buff.String(), ShouldContainSubstring, "Usage")
@ -80,7 +80,7 @@ func TestSearchImageCmd(t *testing.T) {
cmd := NewImageCommand(new(mockService))
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(err, ShouldNotBeNil)
@ -94,7 +94,7 @@ func TestSearchImageCmd(t *testing.T) {
cmd := NewImageCommand(new(mockService))
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
So(err, ShouldBeNil)
@ -163,7 +163,7 @@ func TestSearchImageCmd(t *testing.T) {
cmd := NewImageCommand(new(mockService))
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -179,7 +179,7 @@ func TestSearchImageCmd(t *testing.T) {
imageCmd := NewImageCommand(new(mockService))
buff := bytes.NewBufferString("")
imageCmd.SetOut(buff)
imageCmd.SetErr(ioutil.Discard)
imageCmd.SetErr(buff)
imageCmd.SetArgs(args)
err := imageCmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -193,7 +193,7 @@ func TestSearchImageCmd(t *testing.T) {
defer os.Remove(configPath)
imageCmd := NewImageCommand(new(mockService))
imageCmd.SetOut(buff)
imageCmd.SetErr(ioutil.Discard)
imageCmd.SetErr(buff)
imageCmd.SetArgs(args)
err := imageCmd.Execute()
@ -215,7 +215,7 @@ func TestOutputFormat(t *testing.T) {
cmd := NewImageCommand(new(mockService))
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -233,7 +233,7 @@ func TestOutputFormat(t *testing.T) {
cmd := NewImageCommand(new(mockService))
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -252,7 +252,7 @@ func TestOutputFormat(t *testing.T) {
cmd := NewImageCommand(new(mockService))
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
space := regexp.MustCompile(`\s+`)
@ -270,7 +270,7 @@ func TestOutputFormat(t *testing.T) {
cmd := NewImageCommand(new(mockService))
buff := bytes.NewBufferString("")
cmd.SetOut(buff)
cmd.SetErr(ioutil.Discard)
cmd.SetErr(buff)
cmd.SetArgs(args)
err := cmd.Execute()
space := regexp.MustCompile(`\s+`)

View file

@ -5,7 +5,7 @@ import (
"github.com/anuvu/zot/pkg/api"
"github.com/anuvu/zot/pkg/storage"
"github.com/mitchellh/mapstructure"
dspec "github.com/opencontainers/distribution-spec"
distspec "github.com/opencontainers/distribution-spec/specs-go"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/spf13/viper"
@ -88,10 +88,11 @@ func NewRootCmd() *cobra.Command {
Long: "`zot`",
Run: func(cmd *cobra.Command, args []string) {
if showVersion {
log.Info().Str("distribution-spec", dspec.Version).Str("commit", api.Commit).
log.Info().Str("distribution-spec", distspec.Version).Str("commit", api.Commit).
Str("binary-type", api.BinaryType).Msg("version")
}
_ = cmd.Usage()
cmd.SilenceErrors = false
},
}