From 322190de1e6028098d455e7493c09f4d84ce576e Mon Sep 17 00:00:00 2001 From: Ramkumar Chinchani Date: Tue, 17 Sep 2019 15:45:28 -0700 Subject: [PATCH] coverage: add unit test cases --- WORKSPACE | 387 ++++++++++++++++++++++++------------ go.mod | 1 + go.sum | 13 +- pkg/cli/root_test.go | 38 +++- pkg/storage/storage_test.go | 91 ++++++++- 5 files changed, 399 insertions(+), 131 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 6ca31d90..be22e457 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -6,7 +6,6 @@ go_os = "linux" go_arch = "amd64" - load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") @@ -88,116 +87,135 @@ golangcilint_dependencies() go_repository( name = "co_honnef_go_tools", - commit = "c2f93a96b099", importpath = "honnef.co/go/tools", + sum = "h1:XJP7lxbSxWLOMNdBE4B/STaqVy6L73o0knwj2vIlxnw=", + version = "v0.0.0-20190102054323-c2f93a96b099", ) go_repository( name = "com_github_alecthomas_template", - commit = "a0175ee3bccc", importpath = "github.com/alecthomas/template", + sum = "h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=", + version = "v0.0.0-20160405071501-a0175ee3bccc", ) go_repository( name = "com_github_alecthomas_units", - commit = "2efee857e7cf", importpath = "github.com/alecthomas/units", + sum = "h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=", + version = "v0.0.0-20151022065526-2efee857e7cf", ) go_repository( name = "com_github_armon_consul_api", - commit = "eb2c6b5be1b6", importpath = "github.com/armon/consul-api", + sum = "h1:G1bPvciwNyF7IUmKXNt9Ak3m6u9DE1rF+RmtIkBpVdA=", + version = "v0.0.0-20180202201655-eb2c6b5be1b6", ) go_repository( name = "com_github_beorn7_perks", importpath = "github.com/beorn7/perks", - tag = "v1.0.0", + sum = "h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=", + version = "v1.0.0", ) go_repository( name = "com_github_burntsushi_toml", importpath = "github.com/BurntSushi/toml", - tag = "v0.3.1", + sum = "h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=", + version = "v0.3.1", ) go_repository( name = "com_github_cespare_xxhash", importpath = "github.com/cespare/xxhash", - tag = "v1.1.0", + sum = "h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=", + version = "v1.1.0", ) go_repository( name = "com_github_client9_misspell", importpath = "github.com/client9/misspell", - tag = "v0.3.4", + sum = "h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=", + version = "v0.3.4", ) go_repository( name = "com_github_coreos_bbolt", importpath = "github.com/coreos/bbolt", - tag = "v1.3.2", + sum = "h1:wZwiHHUieZCquLkDL0B8UhzreNWsPHooDAG3q34zk0s=", + version = "v1.3.2", ) go_repository( name = "com_github_coreos_etcd", importpath = "github.com/coreos/etcd", - tag = "v3.3.10", + sum = "h1:jFneRYjIvLMLhDLCzuTuU4rSJUjRplcJQ7pD7MnhC04=", + version = "v3.3.10+incompatible", ) go_repository( name = "com_github_coreos_go_semver", importpath = "github.com/coreos/go-semver", - tag = "v0.2.0", + sum = "h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY=", + version = "v0.2.0", ) go_repository( name = "com_github_coreos_go_systemd", - commit = "95778dfbb74e", importpath = "github.com/coreos/go-systemd", + sum = "h1:Wf6HqHfScWJN9/ZjdUKyjop4mf3Qdd+1TvvltAvM3m8=", + version = "v0.0.0-20190321100706-95778dfbb74e", ) go_repository( name = "com_github_coreos_pkg", - commit = "399ea9e2e55f", importpath = "github.com/coreos/pkg", + sum = "h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg=", + version = "v0.0.0-20180928190104-399ea9e2e55f", ) go_repository( name = "com_github_cpuguy83_go_md2man", importpath = "github.com/cpuguy83/go-md2man", - tag = "v1.0.10", + sum = "h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=", + version = "v1.0.10", ) go_repository( name = "com_github_davecgh_go_spew", importpath = "github.com/davecgh/go-spew", - tag = "v1.1.1", + sum = "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=", + version = "v1.1.1", ) go_repository( name = "com_github_dgrijalva_jwt_go", importpath = "github.com/dgrijalva/jwt-go", - tag = "v3.2.0", + sum = "h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=", + version = "v3.2.0+incompatible", ) go_repository( name = "com_github_dgryski_go_sip13", - commit = "e10d5fee7954", importpath = "github.com/dgryski/go-sip13", + sum = "h1:RMLoZVzv4GliuWafOuPuQDKSm1SJph7uCRnnS61JAn4=", + version = "v0.0.0-20181026042036-e10d5fee7954", ) go_repository( name = "com_github_fsnotify_fsnotify", importpath = "github.com/fsnotify/fsnotify", - tag = "v1.4.7", + sum = "h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=", + version = "v1.4.7", ) go_repository( name = "com_github_ghodss_yaml", importpath = "github.com/ghodss/yaml", - tag = "v1.0.0", + sum = "h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=", + version = "v1.0.0", ) go_repository( @@ -215,211 +233,246 @@ go_repository( go_repository( name = "com_github_go_kit_kit", importpath = "github.com/go-kit/kit", - tag = "v0.8.0", + sum = "h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0=", + version = "v0.8.0", ) go_repository( name = "com_github_go_logfmt_logfmt", importpath = "github.com/go-logfmt/logfmt", - tag = "v0.4.0", + sum = "h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA=", + version = "v0.4.0", ) go_repository( name = "com_github_go_openapi_jsonpointer", importpath = "github.com/go-openapi/jsonpointer", - tag = "v0.17.0", + sum = "h1:nH6xp8XdXHx8dqveo0ZuJBluCO2qGrPbDNZ0dwoRHP0=", + version = "v0.17.0", ) go_repository( name = "com_github_go_openapi_jsonreference", importpath = "github.com/go-openapi/jsonreference", - tag = "v0.19.0", + sum = "h1:BqWKpV1dFd+AuiKlgtddwVIFQsuMpxfBDBHGfM2yNpk=", + version = "v0.19.0", ) go_repository( name = "com_github_go_openapi_spec", importpath = "github.com/go-openapi/spec", - tag = "v0.19.0", + sum = "h1:A4SZ6IWh3lnjH0rG0Z5lkxazMGBECtrZcbyYQi+64k4=", + version = "v0.19.0", ) go_repository( name = "com_github_go_openapi_swag", importpath = "github.com/go-openapi/swag", - tag = "v0.17.0", + sum = "h1:iqrgMg7Q7SvtbWLlltPrkMs0UBJI6oTSs79JFRUi880=", + version = "v0.17.0", ) go_repository( name = "com_github_go_stack_stack", importpath = "github.com/go-stack/stack", - tag = "v1.8.0", + sum = "h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=", + version = "v1.8.0", ) go_repository( name = "com_github_gofrs_uuid", importpath = "github.com/gofrs/uuid", - tag = "v3.2.0", + sum = "h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE=", + version = "v3.2.0+incompatible", ) go_repository( name = "com_github_gogo_protobuf", importpath = "github.com/gogo/protobuf", - tag = "v1.2.1", + sum = "h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=", + version = "v1.2.1", ) go_repository( name = "com_github_golang_glog", - commit = "23def4e6c14b", importpath = "github.com/golang/glog", + sum = "h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=", + version = "v0.0.0-20160126235308-23def4e6c14b", ) go_repository( name = "com_github_golang_groupcache", - commit = "5b532d6fd5ef", importpath = "github.com/golang/groupcache", + sum = "h1:veQD95Isof8w9/WXiA+pa3tz3fJXkt5B7QaRBrM62gk=", + version = "v0.0.0-20190129154638-5b532d6fd5ef", ) go_repository( name = "com_github_golang_mock", importpath = "github.com/golang/mock", - tag = "v1.1.1", + sum = "h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8=", + version = "v1.1.1", ) go_repository( name = "com_github_golang_protobuf", importpath = "github.com/golang/protobuf", - tag = "v1.3.1", + sum = "h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=", + version = "v1.3.1", ) go_repository( name = "com_github_google_btree", importpath = "github.com/google/btree", - tag = "v1.0.0", + sum = "h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=", + version = "v1.0.0", ) go_repository( name = "com_github_google_go_cmp", importpath = "github.com/google/go-cmp", - tag = "v0.2.0", + sum = "h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=", + version = "v0.2.0", ) go_repository( name = "com_github_gopherjs_gopherjs", - commit = "0766667cb4d1", importpath = "github.com/gopherjs/gopherjs", + sum = "h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=", + version = "v0.0.0-20181017120253-0766667cb4d1", ) go_repository( name = "com_github_gorilla_websocket", importpath = "github.com/gorilla/websocket", - tag = "v1.4.0", + sum = "h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=", + version = "v1.4.0", ) go_repository( name = "com_github_grpc_ecosystem_go_grpc_middleware", importpath = "github.com/grpc-ecosystem/go-grpc-middleware", - tag = "v1.0.0", + sum = "h1:Iju5GlWwrvL6UBg4zJJt3btmonfrMlCDdsejg4CZE7c=", + version = "v1.0.0", ) go_repository( name = "com_github_grpc_ecosystem_go_grpc_prometheus", importpath = "github.com/grpc-ecosystem/go-grpc-prometheus", - tag = "v1.2.0", + sum = "h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=", + version = "v1.2.0", ) go_repository( name = "com_github_grpc_ecosystem_grpc_gateway", importpath = "github.com/grpc-ecosystem/grpc-gateway", - tag = "v1.9.0", + sum = "h1:bM6ZAFZmc/wPFaRDi0d5L7hGEZEx/2u+Tmr2evNHDiI=", + version = "v1.9.0", ) go_repository( name = "com_github_hashicorp_hcl", importpath = "github.com/hashicorp/hcl", - tag = "v1.0.0", + sum = "h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=", + version = "v1.0.0", ) go_repository( name = "com_github_inconshreveable_mousetrap", importpath = "github.com/inconshreveable/mousetrap", - tag = "v1.0.0", + sum = "h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=", + version = "v1.0.0", ) go_repository( name = "com_github_jonboulle_clockwork", importpath = "github.com/jonboulle/clockwork", - tag = "v0.1.0", + sum = "h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo=", + version = "v0.1.0", ) go_repository( name = "com_github_json_iterator_go", importpath = "github.com/json-iterator/go", - tag = "v1.1.6", + sum = "h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs=", + version = "v1.1.6", ) go_repository( name = "com_github_jtolds_gls", importpath = "github.com/jtolds/gls", - tag = "v4.20.0", + sum = "h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=", + version = "v4.20.0+incompatible", ) go_repository( name = "com_github_julienschmidt_httprouter", importpath = "github.com/julienschmidt/httprouter", - tag = "v1.2.0", + sum = "h1:TDTW5Yz1mjftljbcKqRcrYhd4XeOoI98t+9HbQbYf7g=", + version = "v1.2.0", ) go_repository( name = "com_github_kisielk_errcheck", importpath = "github.com/kisielk/errcheck", - tag = "v1.1.0", + sum = "h1:ZqfnKyx9KGpRcW04j5nnPDgRgoXUeLh2YFBeFzphcA0=", + version = "v1.1.0", ) go_repository( name = "com_github_kisielk_gotool", importpath = "github.com/kisielk/gotool", - tag = "v1.0.0", + sum = "h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=", + version = "v1.0.0", ) go_repository( name = "com_github_konsorten_go_windows_terminal_sequences", importpath = "github.com/konsorten/go-windows-terminal-sequences", - tag = "v1.0.1", + sum = "h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=", + version = "v1.0.1", ) go_repository( name = "com_github_kr_logfmt", - commit = "b84e30acd515", importpath = "github.com/kr/logfmt", + sum = "h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=", + version = "v0.0.0-20140226030751-b84e30acd515", ) go_repository( name = "com_github_kr_pretty", importpath = "github.com/kr/pretty", - tag = "v0.1.0", + sum = "h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=", + version = "v0.1.0", ) go_repository( name = "com_github_kr_pty", importpath = "github.com/kr/pty", - tag = "v1.1.1", + sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=", + version = "v1.1.1", ) go_repository( name = "com_github_kr_text", importpath = "github.com/kr/text", - tag = "v0.1.0", + sum = "h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=", + version = "v0.1.0", ) go_repository( name = "com_github_magiconair_properties", importpath = "github.com/magiconair/properties", - tag = "v1.8.0", + sum = "h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=", + version = "v1.8.0", ) go_repository( name = "com_github_mailru_easyjson", - commit = "60711f1a8329", importpath = "github.com/mailru/easyjson", + sum = "h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic=", + version = "v0.0.0-20180823135443-60711f1a8329", ) go_repository( @@ -431,229 +484,267 @@ go_repository( go_repository( name = "com_github_matttproud_golang_protobuf_extensions", importpath = "github.com/matttproud/golang_protobuf_extensions", - tag = "v1.0.1", + sum = "h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=", + version = "v1.0.1", ) go_repository( name = "com_github_mitchellh_go_homedir", importpath = "github.com/mitchellh/go-homedir", - tag = "v1.1.0", + sum = "h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=", + version = "v1.1.0", ) go_repository( name = "com_github_mitchellh_mapstructure", importpath = "github.com/mitchellh/mapstructure", - tag = "v1.1.2", + sum = "h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=", + version = "v1.1.2", ) go_repository( name = "com_github_modern_go_concurrent", - commit = "bacd9c7ef1dd", importpath = "github.com/modern-go/concurrent", + sum = "h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=", + version = "v0.0.0-20180306012644-bacd9c7ef1dd", ) go_repository( name = "com_github_modern_go_reflect2", importpath = "github.com/modern-go/reflect2", - tag = "v1.0.1", + sum = "h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=", + version = "v1.0.1", ) go_repository( name = "com_github_mwitkow_go_conntrack", - commit = "cc309e4a2223", importpath = "github.com/mwitkow/go-conntrack", + sum = "h1:F9x/1yl3T2AeKLr2AMdilSD8+f9bvMnNN8VS5iDtovc=", + version = "v0.0.0-20161129095857-cc309e4a2223", ) go_repository( name = "com_github_oklog_ulid", importpath = "github.com/oklog/ulid", - tag = "v1.3.1", + sum = "h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=", + version = "v1.3.1", ) go_repository( name = "com_github_oneofone_xxhash", importpath = "github.com/OneOfOne/xxhash", - tag = "v1.2.2", + sum = "h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=", + version = "v1.2.2", ) go_repository( name = "com_github_opencontainers_distribution_spec", importpath = "github.com/opencontainers/distribution-spec", - tag = "v1.0.0-rc0", + sum = "h1:xMzwhweo1gjvEo74mQjGTLau0TD3ACyTEC1310NbuSQ=", + version = "v1.0.0-rc0", ) go_repository( name = "com_github_opencontainers_go_digest", importpath = "github.com/opencontainers/go-digest", - tag = "v1.0.0-rc1", + sum = "h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=", + version = "v1.0.0-rc1", ) go_repository( name = "com_github_opencontainers_image_spec", importpath = "github.com/opencontainers/image-spec", - tag = "v1.0.1", + sum = "h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI=", + version = "v1.0.1", ) go_repository( name = "com_github_pelletier_go_toml", importpath = "github.com/pelletier/go-toml", - tag = "v1.2.0", + sum = "h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=", + version = "v1.2.0", ) go_repository( name = "com_github_pkg_errors", importpath = "github.com/pkg/errors", - tag = "v0.8.1", + sum = "h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=", + version = "v0.8.1", ) go_repository( name = "com_github_pmezard_go_difflib", importpath = "github.com/pmezard/go-difflib", - tag = "v1.0.0", + sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=", + version = "v1.0.0", ) go_repository( name = "com_github_prometheus_client_golang", importpath = "github.com/prometheus/client_golang", - tag = "v0.9.3", + sum = "h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8=", + version = "v0.9.3", ) go_repository( name = "com_github_prometheus_client_model", - commit = "fd36f4220a90", importpath = "github.com/prometheus/client_model", + sum = "h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE=", + version = "v0.0.0-20190129233127-fd36f4220a90", ) go_repository( name = "com_github_prometheus_common", importpath = "github.com/prometheus/common", - tag = "v0.4.0", + sum = "h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM=", + version = "v0.4.0", ) go_repository( name = "com_github_prometheus_procfs", - commit = "5867b95ac084", importpath = "github.com/prometheus/procfs", + sum = "h1:sofwID9zm4tzrgykg80hfFph1mryUeLRsUfoocVVmRY=", + version = "v0.0.0-20190507164030-5867b95ac084", ) go_repository( name = "com_github_prometheus_tsdb", importpath = "github.com/prometheus/tsdb", - tag = "v0.7.1", + sum = "h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA=", + version = "v0.7.1", ) go_repository( name = "com_github_puerkitobio_purell", importpath = "github.com/PuerkitoBio/purell", - tag = "v1.1.0", + sum = "h1:rmGxhojJlM0tuKtfdvliR84CFHljx9ag64t2xmVkjK4=", + version = "v1.1.0", ) go_repository( name = "com_github_puerkitobio_urlesc", - commit = "de5bf2ad4578", importpath = "github.com/PuerkitoBio/urlesc", + sum = "h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=", + version = "v0.0.0-20170810143723-de5bf2ad4578", ) go_repository( name = "com_github_rogpeppe_fastuuid", - commit = "6724a57986af", importpath = "github.com/rogpeppe/fastuuid", + sum = "h1:gu+uRPtBe88sKxUCEXRoeCvVG90TJmwhiqRpvdhQFng=", + version = "v0.0.0-20150106093220-6724a57986af", ) go_repository( name = "com_github_rs_xid", importpath = "github.com/rs/xid", - tag = "v1.2.1", + sum = "h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc=", + version = "v1.2.1", ) go_repository( name = "com_github_rs_zerolog", importpath = "github.com/rs/zerolog", - tag = "v1.14.3", + sum = "h1:4EGfSkR2hJDB0s3oFfrlPqjU1e4WLncergLil3nEKW0=", + version = "v1.14.3", ) go_repository( name = "com_github_russross_blackfriday", importpath = "github.com/russross/blackfriday", - tag = "v1.5.2", + sum = "h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=", + version = "v1.5.2", ) go_repository( name = "com_github_sirupsen_logrus", importpath = "github.com/sirupsen/logrus", - tag = "v1.2.0", + sum = "h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=", + version = "v1.2.0", ) go_repository( name = "com_github_smartystreets_assertions", - commit = "b2de0cb4f26d", importpath = "github.com/smartystreets/assertions", + sum = "h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=", + version = "v0.0.0-20180927180507-b2de0cb4f26d", ) go_repository( name = "com_github_smartystreets_goconvey", - commit = "9d28bd7c0945", importpath = "github.com/smartystreets/goconvey", + sum = "h1:N8Bg45zpk/UcpNGnfJt2y/3lRWASHNTUET8owPYCgYI=", + version = "v0.0.0-20190710185942-9d28bd7c0945", ) go_repository( name = "com_github_soheilhy_cmux", importpath = "github.com/soheilhy/cmux", - tag = "v0.1.4", + sum = "h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=", + version = "v0.1.4", ) go_repository( name = "com_github_spaolacci_murmur3", - commit = "f09979ecbc72", importpath = "github.com/spaolacci/murmur3", + sum = "h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ=", + version = "v0.0.0-20180118202830-f09979ecbc72", ) go_repository( name = "com_github_spf13_afero", importpath = "github.com/spf13/afero", - tag = "v1.1.2", + sum = "h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=", + version = "v1.1.2", ) go_repository( name = "com_github_spf13_cast", importpath = "github.com/spf13/cast", - tag = "v1.3.0", + sum = "h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=", + version = "v1.3.0", ) go_repository( name = "com_github_spf13_cobra", importpath = "github.com/spf13/cobra", - tag = "v0.0.5", + sum = "h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=", + version = "v0.0.5", ) go_repository( name = "com_github_spf13_jwalterweatherman", importpath = "github.com/spf13/jwalterweatherman", - tag = "v1.0.0", + sum = "h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=", + version = "v1.0.0", ) go_repository( name = "com_github_spf13_pflag", importpath = "github.com/spf13/pflag", - tag = "v1.0.3", + sum = "h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=", + version = "v1.0.3", ) go_repository( name = "com_github_spf13_viper", importpath = "github.com/spf13/viper", - tag = "v1.4.0", + sum = "h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU=", + version = "v1.4.0", ) go_repository( name = "com_github_stretchr_objx", importpath = "github.com/stretchr/objx", - tag = "v0.1.1", + sum = "h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=", + version = "v0.1.1", ) go_repository( name = "com_github_stretchr_testify", importpath = "github.com/stretchr/testify", - tag = "v1.3.0", + sum = "h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=", + version = "v1.3.0", ) go_repository( @@ -665,19 +756,22 @@ go_repository( go_repository( name = "com_github_swaggo_swag", importpath = "github.com/swaggo/swag", - tag = "v1.6.2", + sum = "h1:WQMAtT/FmMBb7g0rAuHDhG3vvdtHKJ3WZ+Ssb0p4Y6E=", + version = "v1.6.2", ) go_repository( name = "com_github_tmc_grpc_websocket_proxy", - commit = "0ad062ec5ee5", importpath = "github.com/tmc/grpc-websocket-proxy", + sum = "h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ=", + version = "v0.0.0-20190109142713-0ad062ec5ee5", ) go_repository( name = "com_github_ugorji_go", importpath = "github.com/ugorji/go", - tag = "v1.1.4", + sum = "h1:j4s+tAvLfL3bZyefP2SEWmhBzmuIlH/eqNuPdFPgngw=", + version = "v1.1.4", ) go_repository( @@ -689,43 +783,50 @@ go_repository( go_repository( name = "com_github_urfave_cli", importpath = "github.com/urfave/cli", - tag = "v1.20.0", + sum = "h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=", + version = "v1.20.0", ) go_repository( name = "com_github_xiang90_probing", - commit = "43a291ad63a2", importpath = "github.com/xiang90/probing", + sum = "h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=", + version = "v0.0.0-20190116061207-43a291ad63a2", ) go_repository( name = "com_github_xordataexchange_crypt", - commit = "b2862e3d0a77", importpath = "github.com/xordataexchange/crypt", + sum = "h1:ESFSdwYZvkeru3RtdrYueztKhOBCSAAzS4Gf+k0tEow=", + version = "v0.0.3-0.20170626215501-b2862e3d0a77", ) go_repository( name = "com_github_zenazn_goji", importpath = "github.com/zenazn/goji", - tag = "v0.9.0", + sum = "h1:RSQQAbXGArQ0dIDEq+PI6WqN6if+5KHu6x2Cx/GXLTQ=", + version = "v0.9.0", ) go_repository( name = "com_google_cloud_go", importpath = "cloud.google.com/go", - tag = "v0.26.0", + sum = "h1:e0WKqKTd5BnrG8aKH3J3h+QvEIQtSUcf2n5UZ5ZgLtQ=", + version = "v0.26.0", ) go_repository( name = "in_gopkg_alecthomas_kingpin_v2", importpath = "gopkg.in/alecthomas/kingpin.v2", - tag = "v2.2.6", + sum = "h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=", + version = "v2.2.6", ) go_repository( name = "in_gopkg_check_v1", - commit = "788fd7840127", importpath = "gopkg.in/check.v1", + sum = "h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=", + version = "v1.0.0-20180628173108-788fd7840127", ) go_repository( @@ -743,131 +844,167 @@ go_repository( go_repository( name = "in_gopkg_resty_v1", importpath = "gopkg.in/resty.v1", - tag = "v1.12.0", + sum = "h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI=", + version = "v1.12.0", ) go_repository( name = "in_gopkg_yaml_v2", importpath = "gopkg.in/yaml.v2", - tag = "v2.2.2", + sum = "h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=", + version = "v2.2.2", ) go_repository( name = "io_etcd_go_bbolt", importpath = "go.etcd.io/bbolt", - tag = "v1.3.2", + sum = "h1:Z/90sZLPOeCy2PwprqkFa25PdkusRzaj9P8zm/KNyvk=", + version = "v1.3.2", ) go_repository( name = "org_golang_google_appengine", importpath = "google.golang.org/appengine", - tag = "v1.1.0", + sum = "h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs=", + version = "v1.1.0", ) go_repository( name = "org_golang_google_genproto", - commit = "c66870c02cf8", importpath = "google.golang.org/genproto", + sum = "h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=", + version = "v0.0.0-20180817151627-c66870c02cf8", ) go_repository( name = "org_golang_google_grpc", importpath = "google.golang.org/grpc", - tag = "v1.21.0", + sum = "h1:G+97AoqBnmZIT91cLG/EkCoK9NSelj64P8bOHHNmGn0=", + version = "v1.21.0", ) go_repository( name = "org_golang_x_crypto", - commit = "4def268fd1a4", importpath = "golang.org/x/crypto", + sum = "h1:7KByu05hhLed2MO29w7p1XfZvZ13m8mub3shuVftRs0=", + version = "v0.0.0-20190820162420-60c769a6c586", ) go_repository( name = "org_golang_x_lint", - commit = "d0100b6bd8b3", importpath = "golang.org/x/lint", + sum = "h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0=", + version = "v0.0.0-20190313153728-d0100b6bd8b3", ) go_repository( name = "org_golang_x_net", - commit = "f3200d17e092", importpath = "golang.org/x/net", + sum = "h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM=", + version = "v0.0.0-20190827160401-ba9fcec4b297", ) go_repository( name = "org_golang_x_oauth2", - commit = "d2e6202438be", importpath = "golang.org/x/oauth2", + sum = "h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=", + version = "v0.0.0-20180821212333-d2e6202438be", ) go_repository( name = "org_golang_x_sync", - commit = "112230192c58", importpath = "golang.org/x/sync", + sum = "h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=", + version = "v0.0.0-20190423024810-112230192c58", ) go_repository( name = "org_golang_x_sys", - commit = "97732733099d", importpath = "golang.org/x/sys", + sum = "h1:ng0gs1AKnRRuEMZoTLLlbOd+C17zUDepwGQBb/n+JVg=", + version = "v0.0.0-20190826190057-c7b8b68b1456", ) go_repository( name = "org_golang_x_text", importpath = "golang.org/x/text", - tag = "v0.3.0", + sum = "h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=", + version = "v0.3.2", ) go_repository( name = "org_golang_x_time", - commit = "9d24e82272b4", importpath = "golang.org/x/time", + sum = "h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ=", + version = "v0.0.0-20190308202827-9d24e82272b4", ) go_repository( name = "org_golang_x_tools", - commit = "4d9ae51c2468", importpath = "golang.org/x/tools", + sum = "h1:0JEq5ZQ3TgsRlFmz4BcD+E6U6cOk4pOImCQSyIG59ZM=", + version = "v0.0.0-20190827205025-b29f5f60c37a", ) go_repository( name = "org_uber_go_atomic", importpath = "go.uber.org/atomic", - tag = "v1.4.0", + sum = "h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=", + version = "v1.4.0", ) go_repository( name = "org_uber_go_multierr", importpath = "go.uber.org/multierr", - tag = "v1.1.0", + sum = "h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=", + version = "v1.1.0", ) go_repository( name = "org_uber_go_zap", importpath = "go.uber.org/zap", - tag = "v1.10.0", + sum = "h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM=", + version = "v1.10.0", ) go_repository( name = "com_github_gorilla_mux", importpath = "github.com/gorilla/mux", - tag = "v1.7.3", + sum = "h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=", + version = "v1.7.3", ) go_repository( name = "com_github_kylebanks_depth", importpath = "github.com/KyleBanks/depth", - tag = "v1.2.1", + sum = "h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=", + version = "v1.2.1", ) go_repository( name = "com_github_swaggo_files", - commit = "630677cd5c14", importpath = "github.com/swaggo/files", + sum = "h1:PyYN9JH5jY9j6av01SpfRMb+1DWg/i3MbGOKPxJ2wjM=", + version = "v0.0.0-20190704085106-630677cd5c14", ) go_repository( name = "com_github_swaggo_http_swagger", - commit = "c2865af9083e", importpath = "github.com/swaggo/http-swagger", + sum = "h1:m5sYJ43teIUlESuKRFQRRm7kqi6ExiYwVKfoXNuRgHU=", + version = "v0.0.0-20190614090009-c2865af9083e", +) + +go_repository( + name = "com_github_go_chi_chi", + importpath = "github.com/go-chi/chi", + sum = "h1:maB6vn6FqCxrpz4FqWdh4+lwpyZIQS7YEAUcHlgXVRs=", + version = "v4.0.2+incompatible", +) + +go_repository( + name = "org_golang_x_xerrors", + importpath = "golang.org/x/xerrors", + sum = "h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=", + version = "v0.0.0-20190717185122-a985d3407aa7", ) diff --git a/go.mod b/go.mod index 2057fe00..083be3cc 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.12 require ( github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc + github.com/go-chi/chi v4.0.2+incompatible // indirect github.com/gofrs/uuid v3.2.0+incompatible github.com/gorilla/mux v1.7.3 github.com/json-iterator/go v1.1.6 diff --git a/go.sum b/go.sum index f266f6e8..e04e9819 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,5 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= @@ -23,12 +24,15 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-chi/chi v4.0.2+incompatible h1:maB6vn6FqCxrpz4FqWdh4+lwpyZIQS7YEAUcHlgXVRs= +github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= @@ -53,6 +57,7 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= @@ -62,6 +67,7 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs= @@ -73,8 +79,10 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -101,6 +109,7 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= @@ -139,6 +148,7 @@ github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/y github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14 h1:PyYN9JH5jY9j6av01SpfRMb+1DWg/i3MbGOKPxJ2wjM= github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= @@ -160,8 +170,6 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 h1:7KByu05hhLed2MO29w7p1XfZvZ13m8mub3shuVftRs0= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -214,6 +222,7 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= diff --git a/pkg/cli/root_test.go b/pkg/cli/root_test.go index 9951ec3d..31d32ee4 100644 --- a/pkg/cli/root_test.go +++ b/pkg/cli/root_test.go @@ -1,6 +1,7 @@ package cli_test import ( + "io/ioutil" "os" "testing" @@ -12,29 +13,60 @@ func TestUsage(t *testing.T) { oldArgs := os.Args defer func() { os.Args = oldArgs }() - Convey("Test Usage", t, func(c C) { + Convey("Test usage", t, func(c C) { os.Args = []string{"cli_test", "help"} err := cli.NewRootCmd().Execute() So(err, ShouldBeNil) }) + + Convey("Test version", t, func(c C) { + os.Args = []string{"cli_test", "--version"} + err := cli.NewRootCmd().Execute() + So(err, ShouldBeNil) + }) } func TestServe(t *testing.T) { oldArgs := os.Args defer func() { os.Args = oldArgs }() - Convey("Test Usage", t, func(c C) { + Convey("Test serve help", t, func(c C) { os.Args = []string{"cli_test", "serve", "-h"} err := cli.NewRootCmd().Execute() So(err, ShouldBeNil) }) + + Convey("Test serve config", t, func(c C) { + Convey("unknown config", func(c C) { + os.Args = []string{"cli_test", "serve", "/tmp/x"} + So(func() { _ = cli.NewRootCmd().Execute() }, ShouldPanic) + }) + + Convey("non-existent config", func(c C) { + os.Args = []string{"cli_test", "serve", "/tmp/x.yaml"} + So(func() { _ = cli.NewRootCmd().Execute() }, ShouldPanic) + }) + + Convey("bad config", func(c C) { + tmpfile, err := ioutil.TempFile("", "zot-test*.json") + So(err, ShouldBeNil) + defer os.Remove(tmpfile.Name()) // clean up + content := []byte(`{"log":{}}`) + _, err = tmpfile.Write(content) + So(err, ShouldBeNil) + err = tmpfile.Close() + So(err, ShouldBeNil) + os.Args = []string{"cli_test", "serve", tmpfile.Name()} + So(func() { _ = cli.NewRootCmd().Execute() }, ShouldPanic) + }) + }) } func TestGC(t *testing.T) { oldArgs := os.Args defer func() { os.Args = oldArgs }() - Convey("Test Usage", t, func(c C) { + Convey("Test gc", t, func(c C) { os.Args = []string{"cli_test", "garbage-collect", "-h"} err := cli.NewRootCmd().Execute() So(err, ShouldBeNil) diff --git a/pkg/storage/storage_test.go b/pkg/storage/storage_test.go index 4aff1ae1..516a0f61 100644 --- a/pkg/storage/storage_test.go +++ b/pkg/storage/storage_test.go @@ -1,16 +1,21 @@ package storage_test import ( + "bytes" + _ "crypto/sha256" + "encoding/json" "io/ioutil" "os" "testing" "github.com/anuvu/zot/pkg/storage" + godigest "github.com/opencontainers/go-digest" + ispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/rs/zerolog" . "github.com/smartystreets/goconvey/convey" ) -func TestRepoLayout(t *testing.T) { +func TestAPIs(t *testing.T) { dir, err := ioutil.TempDir("", "oci-repo-test") if err != nil { panic(err) @@ -35,7 +40,91 @@ func TestRepoLayout(t *testing.T) { Convey("Validate repo", func() { v, err := il.ValidateRepo(repoName) + So(err, ShouldBeNil) So(v, ShouldEqual, true) + }) + + Convey("Get repos", func() { + v, err := il.GetRepositories() + So(err, ShouldBeNil) + So(v, ShouldNotBeEmpty) + }) + + Convey("Get image tags", func() { + v, err := il.GetImageTags("test") + So(err, ShouldBeNil) + So(v, ShouldBeEmpty) + }) + + Convey("New blob upload", func() { + v, err := il.NewBlobUpload("test") + So(err, ShouldBeNil) + So(v, ShouldNotBeEmpty) + + Convey("Get blob upload", func() { + b, err := il.GetBlobUpload("test", "invalid") + So(err, ShouldNotBeNil) + So(b, ShouldEqual, -1) + + b, err = il.GetBlobUpload("test", v) + So(err, ShouldBeNil) + So(b, ShouldBeGreaterThanOrEqualTo, 0) + + b, err = il.BlobUploadInfo("test", v) + So(err, ShouldBeNil) + So(b, ShouldBeGreaterThanOrEqualTo, 0) + + content := []byte("test-data") + buf := bytes.NewBuffer(content) + l := buf.Len() + d := godigest.FromBytes(content) + b, err = il.PutBlobChunk("test", v, 0, int64(l), buf) + So(err, ShouldBeNil) + So(b, ShouldEqual, l) + + err = il.FinishBlobUpload("test", v, buf, d.String()) + So(err, ShouldBeNil) + So(b, ShouldEqual, l) + + _, _, err = il.CheckBlob("test", d.String(), "application/vnd.oci.image.layer.v1.tar+gzip") + So(err, ShouldBeNil) + + _, _, err = il.GetBlob("test", d.String(), "application/vnd.oci.image.layer.v1.tar+gzip") + So(err, ShouldBeNil) + + m := ispec.Manifest{} + mb, _ := json.Marshal(m) + + Convey("Bad image manifest", func() { + _, err = il.PutImageManifest("test", d.String(), ispec.MediaTypeImageManifest, mb) + So(err, ShouldNotBeNil) + + _, _, _, err = il.GetImageManifest("test", d.String()) + So(err, ShouldNotBeNil) + }) + + Convey("Good image manifest", func() { + m := ispec.Manifest{Layers: []ispec.Descriptor{{Digest: d}}} + mb, _ = json.Marshal(m) + d := godigest.FromBytes(mb) + _, err = il.PutImageManifest("test", d.String(), ispec.MediaTypeImageManifest, mb) + So(err, ShouldBeNil) + + _, _, _, err = il.GetImageManifest("test", d.String()) + So(err, ShouldBeNil) + + err = il.DeleteImageManifest("test", d.String()) + So(err, ShouldBeNil) + + _, _, _, err = il.GetImageManifest("test", d.String()) + So(err, ShouldNotBeNil) + }) + + err = il.DeleteBlob("test", d.String()) + So(err, ShouldBeNil) + }) + + err = il.DeleteBlobUpload("test", v) So(err, ShouldBeNil) }) })