Hello community,

here is the log from the commit of package helm-mirror for openSUSE:Factory 
checked in at 2019-01-08 12:29:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/helm-mirror (Old)
 and      /work/SRC/openSUSE:Factory/.helm-mirror.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "helm-mirror"

Tue Jan  8 12:29:15 2019 rev:5 rq:663332 version:0.2.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/helm-mirror/helm-mirror.changes  2019-01-05 
14:42:46.140459316 +0100
+++ /work/SRC/openSUSE:Factory/.helm-mirror.new.28833/helm-mirror.changes       
2019-01-08 12:31:26.184078801 +0100
@@ -1,0 +2,10 @@
+Fri Jan  4 10:47:01 UTC 2019 - Vicente Zepeda <vzepeda...@suse.com>
+
+## v0.2.1
+
+- fixes empty archive files
+- usage of ignore-errors flag
+
+fix bsc#1120762
+
+-------------------------------------------------------------------

Old:
----
  helm-mirror-0.2.0.tar.gz

New:
----
  helm-mirror-0.2.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ helm-mirror.spec ++++++
--- /var/tmp/diff_new_pack.9AhirG/_old  2019-01-08 12:31:26.552078400 +0100
+++ /var/tmp/diff_new_pack.9AhirG/_new  2019-01-08 12:31:26.552078400 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package helm-mirror
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -20,7 +20,7 @@
 %define project github.com/openSUSE/helm-mirror
 
 Name:           helm-mirror
-Version:        0.2.0
+Version:        0.2.1
 Release:        0
 Summary:        Tool to mirror Helm repositories
 License:        Apache-2.0

++++++ _service ++++++
--- /var/tmp/diff_new_pack.9AhirG/_old  2019-01-08 12:31:26.584078366 +0100
+++ /var/tmp/diff_new_pack.9AhirG/_new  2019-01-08 12:31:26.584078366 +0100
@@ -2,8 +2,8 @@
   <service name="download_url" mode="disabled">
     <param name="protocol">https</param>
     <param name="host">codeload.github.com</param>
-    <param name="path">openSUSE/helm-mirror/tar.gz/v0.2.0</param>
-    <param name="filename">helm-mirror-0.2.0.tar.gz</param>
+    <param name="path">openSUSE/helm-mirror/tar.gz/v0.2.1</param>
+    <param name="filename">helm-mirror-0.2.1.tar.gz</param>
   </service>
   <service name="recompress" mode="disabled">
     <param name="compression">gz</param>

++++++ helm-mirror-0.2.0.tar.gz -> helm-mirror-0.2.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/helm-mirror-0.2.0/CHANGELOG.md 
new/helm-mirror-0.2.1/CHANGELOG.md
--- old/helm-mirror-0.2.0/CHANGELOG.md  2018-12-04 12:00:48.000000000 +0100
+++ new/helm-mirror-0.2.1/CHANGELOG.md  2019-01-03 15:12:28.000000000 +0100
@@ -7,6 +7,10 @@
 
 ## [Unreleased]
 
+## v0.2.1
+
+- fixes empty archive files and usage of ignore-errors flag
+
 ## v0.2.0
 
 ### Added
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/helm-mirror-0.2.0/README.md 
new/helm-mirror-0.2.1/README.md
--- old/helm-mirror-0.2.0/README.md     2018-12-04 12:00:48.000000000 +0100
+++ new/helm-mirror-0.2.1/README.md     2019-01-03 15:12:28.000000000 +0100
@@ -70,6 +70,7 @@
       --ca-file string     verify certificates of HTTPS-enabled servers using 
this CA bundle
       --cert-file string   identify HTTPS client using this SSL certificate 
file
   -h, --help               help for mirror
+  -i, --ignore-errors      ignores errors while downloading or processing 
charts
       --key-file string    identify HTTPS client using this SSL key file
       --new-root-url       New root url of the chart repository (eg: 
`https://mirror.local.lan/charts`)
       --password string    chart repository password
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/helm-mirror-0.2.0/cmd/inspectImages.go 
new/helm-mirror-0.2.1/cmd/inspectImages.go
--- old/helm-mirror-0.2.0/cmd/inspectImages.go  2018-12-04 12:00:48.000000000 
+0100
+++ new/helm-mirror-0.2.1/cmd/inspectImages.go  2019-01-03 15:12:28.000000000 
+0100
@@ -27,10 +27,8 @@
 )
 
 var (
-       //IgnoreErrors ignores errors in processing charts
-       IgnoreErrors bool
-       output       string
-       target       string
+       output string
+       target string
 )
 
 const imagesDesc = `Extract all the images of the Helm Chart or
@@ -78,7 +76,7 @@
 }
 
 func init() {
-       inspectImagesCmd.PersistentFlags().BoolVarP(&IgnoreErrors, 
"ignore-errors", "i", false, "ignores errors whiles processing charts. (Exit 
Code: 2)")
+
        inspectImagesCmd.PersistentFlags().StringVarP(&output, "output", "o", 
"stdout", outputDesc)
        rootCmd.AddCommand(inspectImagesCmd)
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/helm-mirror-0.2.0/cmd/root.go 
new/helm-mirror-0.2.1/cmd/root.go
--- old/helm-mirror-0.2.0/cmd/root.go   2018-12-04 12:00:48.000000000 +0100
+++ new/helm-mirror-0.2.1/cmd/root.go   2019-01-03 15:12:28.000000000 +0100
@@ -30,18 +30,20 @@
 
 var (
        //Verbose defines if the command is being run with verbose mode
-       Verbose    bool
-       folder     string
-       repoURL    *url.URL
-       flags      = log.Ldate | log.Lmicroseconds | log.Lshortfile
-       prefix     = "helm-mirror: "
-       logger     *log.Logger
-       username   string
-       password   string
-       caFile     string
-       certFile   string
-       keyFile    string
-       newRootURL string
+       Verbose bool
+       //IgnoreErrors ignores errors in processing charts
+       IgnoreErrors bool
+       folder       string
+       repoURL      *url.URL
+       flags        = log.Ldate | log.Lmicroseconds | log.Lshortfile
+       prefix       = "helm-mirror: "
+       logger       *log.Logger
+       username     string
+       password     string
+       caFile       string
+       certFile     string
+       keyFile      string
+       newRootURL   string
 )
 
 const rootDesc = `Mirror Helm Charts from an index file into a local folder.
@@ -103,7 +105,7 @@
 func init() {
        logger = log.New(os.Stdout, prefix, flags)
        rootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, 
"verbose output")
-
+       rootCmd.PersistentFlags().BoolVarP(&IgnoreErrors, "ignore-errors", "i", 
false, "ignores errors while downloading or processing charts")
        rootCmd.Flags().StringVar(&username, "username", "", "chart repository 
username")
        rootCmd.Flags().StringVar(&password, "password", "", "chart repository 
password")
        rootCmd.Flags().StringVar(&caFile, "ca-file", "", "verify certificates 
of HTTPS-enabled servers using this CA bundle")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/helm-mirror-0.2.0/cmd/root_test.go 
new/helm-mirror-0.2.1/cmd/root_test.go
--- old/helm-mirror-0.2.0/cmd/root_test.go      2018-12-04 12:00:48.000000000 
+0100
+++ new/helm-mirror-0.2.1/cmd/root_test.go      2019-01-03 15:12:28.000000000 
+0100
@@ -3,13 +3,12 @@
 import (
        "fmt"
        "io/ioutil"
-       "log"
-       "net/http"
        "os"
        "path"
        "path/filepath"
        "testing"
 
+       "github.com/openSUSE/helm-mirror/fixtures"
        "github.com/spf13/cobra"
 )
 
@@ -54,30 +53,35 @@
                t.Errorf("creating temp dir: %s", err)
        }
        defer os.RemoveAll(dir)
-       svr := startHTTPServer()
+       svr := fixtures.StartHTTPServer()
+       fixtures.WaitForServer(svr.Addr)
        type args struct {
-               cmd        *cobra.Command
-               args       []string
-               newRootURL string
+               cmd          *cobra.Command
+               args         []string
+               newRootURL   string
+               ignoreErrors bool
        }
        tests := []struct {
                name    string
                args    args
                wantErr bool
        }{
-               {"1", args{&cobra.Command{}, []string{"http://test";, 
path.Join("/mr", "mzxyptlk")}, ""}, true},
-               {"2", args{&cobra.Command{}, []string{"http://127.0.0.1:1793";, 
dir}, ""}, false},
-               {"3", args{&cobra.Command{}, []string{"%", dir}, ""}, true},
-               {"4", args{&cobra.Command{}, []string{"http://test";, dir}, 
"%"}, true},
-               {"5", args{&cobra.Command{}, []string{"http://test";, dir}, 
"ftp://test"}, true},
-               {"6", args{&cobra.Command{}, []string{"http://127.0.0.1:1793";, 
dir}, "https://test/com/charts"}, false},
-               {"7", args{&cobra.Command{}, []string{"http://127.0.0.1:1111";, 
dir}, "https://test/com/charts"}, true},
+               {"1", args{&cobra.Command{}, []string{"http://test";, 
path.Join("/mr", "mzxyptlk")}, "", false}, true},
+               {"2", args{&cobra.Command{}, []string{"http://127.0.0.1:1793";, 
dir}, "", true}, false},
+               {"3", args{&cobra.Command{}, []string{"%", dir}, "", false}, 
true},
+               {"4", args{&cobra.Command{}, []string{"http://test";, dir}, "%", 
false}, true},
+               {"5", args{&cobra.Command{}, []string{"http://test";, dir}, 
"ftp://test";, false}, true},
+               {"6", args{&cobra.Command{}, []string{"http://127.0.0.1:1793";, 
dir}, "https://test/com/charts";, true}, false},
+               {"7", args{&cobra.Command{}, []string{"http://127.0.0.1:1111";, 
dir}, "https://test/com/charts";, false}, true},
+               {"8", args{&cobra.Command{}, []string{"http://127.0.0.1:1793";, 
dir, "--ignore-errors"}, "https://test/com/charts";, true}, false},
+               {"9", args{&cobra.Command{}, []string{"http://127.0.0.1:1793";, 
dir}, "", false}, true},
        }
        for _, tt := range tests {
                t.Run(tt.name, func(t *testing.T) {
                        fmt.Printf("%s clean\n", filepath.Clean(dir))
                        fmt.Printf("%v\n", tt.args.args[1])
                        newRootURL = tt.args.newRootURL
+                       IgnoreErrors = tt.args.ignoreErrors
                        if err := runRoot(tt.args.cmd, tt.args.args); (err != 
nil) != tt.wantErr {
                                t.Errorf("runRoot() error = %v, wantErr %v", 
err, tt.wantErr)
                        }
@@ -87,60 +91,3 @@
                t.Errorf("error stoping down web server")
        }
 }
-
-func startHTTPServer() *http.Server {
-       srv := &http.Server{Addr: ":1793"}
-       http.HandleFunc("/index.yaml", indexFile)
-       http.HandleFunc("/chart1-2.11.0.tgz", chartTgz)
-       http.HandleFunc("/chart2-1.0.1.tgz", chartTgz)
-       http.HandleFunc("/chart2-0.0.0-pre.tgz", chartTgz)
-       go func() {
-               if err := srv.ListenAndServe(); err != nil {
-                       log.Printf("Httpserver: ListenAndServe() error: %s", 
err)
-               }
-       }()
-       return srv
-}
-
-func indexFile(w http.ResponseWriter, r *http.Request) {
-       w.Header().Set("Content-Type", "binary/octet-stream")
-       w.Write(indexYaml)
-}
-
-func chartTgz(w http.ResponseWriter, r *http.Request) {
-       w.Header().Set("Content-Type", "binary/octet-stream")
-       w.Write(chartTGZ)
-}
-
-var indexYaml = []byte(`apiVersion: v1
-entries:
-  chart1:
-  - apiVersion: v2
-    created: 2018-09-20T00:00:00.000000000Z
-    description: A Helm chart for testing
-    digest: 8cc99f9cb669171776f7c6ec66069907579be91179f9201725fc6fc6f9ef1f29
-    name: chart1
-    urls:
-    - http://127.0.0.1:1793/chart1-2.11.0.tgz
-    version: 2.11.0
-  chart2:
-  - apiVersion: v1
-    created: 2018-09-20T00:00:00.000000000Z
-    description: A Helm chart for testing too
-    digest: 0c76ee9b4b78cb60fcce8c00ec0f5048cbe626fcaabe48f2f8e84b029e894f49
-    name: chart2
-    urls:
-    - http://127.0.0.1:1793/chart2-1.0.1.tgz
-    version: 1.0.1
-  - apiVersion: v1
-    created: 2018-09-20T00:00:00.000000000Z
-    description: A Helm chart for testing too
-    digest: e9a545006570b7fc5e4458f6eae178c2aa8f8e9e57eafac59869c856b86e862f
-    name: chart2
-    urls:
-    - http://127.0.0.1:1793/chart2-0.0.0-pre.tgz
-    version: 0.0.0-pre
-`)
-
-var chartTGZ = []byte{31, 139, 8, 0, 224, 223, 181, 91, 0, 3, 237, 193, 1, 13, 
0, 0, 0, 194,
-       160, 247, 79, 109, 14, 55, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 55, 3, 
154, 222, 29, 39, 0, 40, 0, 0}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/helm-mirror-0.2.0/doc/man/helm-mirror-inspect-images.1.md 
new/helm-mirror-0.2.1/doc/man/helm-mirror-inspect-images.1.md
--- old/helm-mirror-0.2.0/doc/man/helm-mirror-inspect-images.1.md       
2018-12-04 12:00:48.000000000 +0100
+++ new/helm-mirror-0.2.1/doc/man/helm-mirror-inspect-images.1.md       
2019-01-03 15:12:28.000000000 +0100
@@ -28,7 +28,7 @@
   Print usage statement.
 
 **-i, --ignore-errors**
-  Ignores errors whiles processing charts. (Exit Code: 2)
+  Ignores errors while downloading or processing charts.
 
 **-o, --output**
   choose an output for the list of images and specify the file name, if not 
specified 'images.out' will be the default.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/helm-mirror-0.2.0/doc/man/helm-mirror.1.md 
new/helm-mirror-0.2.1/doc/man/helm-mirror.1.md
--- old/helm-mirror-0.2.0/doc/man/helm-mirror.1.md      2018-12-04 
12:00:48.000000000 +0100
+++ new/helm-mirror-0.2.1/doc/man/helm-mirror.1.md      2019-01-03 
15:12:28.000000000 +0100
@@ -75,6 +75,9 @@
 **--cert-file**
   Identify HTTPS client using this SSL certificate file
 
+**-i, --ignore-errors**
+  Ignores errors while downloading or processing charts.
+
 **--key-file**
   Identify HTTPS client using this SSL key file
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/helm-mirror-0.2.0/fixtures/test_utils.go 
new/helm-mirror-0.2.1/fixtures/test_utils.go
--- old/helm-mirror-0.2.0/fixtures/test_utils.go        1970-01-01 
01:00:00.000000000 +0100
+++ new/helm-mirror-0.2.1/fixtures/test_utils.go        2019-01-03 
15:12:28.000000000 +0100
@@ -0,0 +1,92 @@
+package fixtures
+
+import (
+       "log"
+       "net/http"
+       "time"
+)
+
+// StartHTTPServer start http server for tests
+func StartHTTPServer() *http.Server {
+       srv := &http.Server{Addr: ":1793"}
+       http.HandleFunc("/index.yaml", indexFile)
+       http.HandleFunc("/chart1-2.11.0.tgz", chartTgz)
+       http.HandleFunc("/chart2-1.0.1.tgz", chartTgz)
+       http.HandleFunc("/chart2-0.0.0-pre.tgz", chartTgz)
+       go func() {
+               if err := srv.ListenAndServe(); err != nil {
+                       log.Printf("Httpserver: ListenAndServe() error: %s", 
err)
+               }
+       }()
+       return srv
+}
+
+// WaitForServer waits until the server is up
+func WaitForServer(url string) {
+       var retry = 10
+       for i := 0; i < retry; i++ {
+               resp, err := http.Get(url)
+               if err != nil {
+                       time.Sleep(2)
+                       continue
+               }
+               if resp.StatusCode == http.StatusOK {
+                       return
+               }
+       }
+}
+
+func indexFile(w http.ResponseWriter, r *http.Request) {
+       w.Header().Set("Content-Type", "binary/octet-stream")
+       w.Write([]byte(IndexYaml))
+}
+
+func chartTgz(w http.ResponseWriter, r *http.Request) {
+       w.Header().Set("Content-Type", "binary/octet-stream")
+       w.Write(chartTGZ)
+}
+
+var chartTGZ = []byte{31, 139, 8, 0, 224, 223, 181, 91, 0, 3, 237, 193, 1, 13, 
0, 0, 0, 194,
+       160, 247, 79, 109, 14, 55, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 55, 3, 
154, 222, 29, 39, 0, 40, 0, 0}
+
+//Expectedcharts How many charts are in the test file
+var Expectedcharts = 4
+
+//IndexYaml test index file
+var IndexYaml = `apiVersion: v1
+entries:
+  chart1:
+  - apiVersion: v2
+    created: 2018-09-20T00:00:00.000000000Z
+    description: A Helm chart for testing
+    digest: 8cc99f9cb669171776f7c6ec66069907579be91179f9201725fc6fc6f9ef1f29
+    name: chart1
+    urls:
+    - http://127.0.0.1:1793/chart1-2.11.0.tgz
+    version: 2.11.0
+  chart2:
+  - apiVersion: v1
+    created: 2018-09-20T00:00:00.000000000Z
+    description: A Helm chart for testing too
+    digest: 0c76ee9b4b78cb60fcce8c00ec0f5048cbe626fcaabe48f2f8e84b029e894f49
+    name: chart2
+    urls:
+    - http://127.0.0.1:1793/chart2-1.0.1.tgz
+    version: 1.0.1
+  - apiVersion: v1
+    created: 2018-09-20T00:00:00.000000000Z
+    description: A Helm chart for testing too
+    digest: e9a545006570b7fc5e4458f6eae178c2aa8f8e9e57eafac59869c856b86e862f
+    name: chart2
+    urls:
+    - http://127.0.0.1:1793/chart2-0.0.0-pre.tgz
+    version: 0.0.0-pre
+  - apiVersion: v1
+    created: 2018-12-18T00:00:00.000000000Z
+    description: A Helm chart that does not exist
+    digest: f9a848106870c7fc8f4488f6faf178c2aa8f8f9f87fafac89819c886c86e862f
+    name: chart3
+    urls:
+    - http://127.0.0.1:1793/chart3-0.0.1-pre.tgz
+    version: 0.0.1-pre
+`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/helm-mirror-0.2.0/plugin.yaml 
new/helm-mirror-0.2.1/plugin.yaml
--- old/helm-mirror-0.2.0/plugin.yaml   2018-12-04 12:00:48.000000000 +0100
+++ new/helm-mirror-0.2.1/plugin.yaml   2019-01-03 15:12:28.000000000 +0100
@@ -1,6 +1,6 @@
 name: "mirror"
 # plugin
-version: "0.2.0"
+version: "0.2.1"
 usage: "Mirror Helm Charts from a repository into a local folder."
 description: "Mirror Helm Charts from a repository into a local folder."
 useTunnel: true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/helm-mirror-0.2.0/scripts/cover.sh 
new/helm-mirror-0.2.1/scripts/cover.sh
--- old/helm-mirror-0.2.0/scripts/cover.sh      2018-12-04 12:00:48.000000000 
+0100
+++ new/helm-mirror-0.2.1/scripts/cover.sh      2019-01-03 15:12:28.000000000 
+0100
@@ -8,7 +8,7 @@
 rm -rf "$workdir"
 mkdir "$workdir"
 
-for d in $(go list ./... | grep -v vendor); do
+for d in $(go list ./... | grep -v -E "vendor|fixtures"); do
     f="$workdir/$(echo $d | tr / -).cover"
     go test -covermode="$mode" -coverprofile="$f" $d
 done
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/helm-mirror-0.2.0/service/get.go 
new/helm-mirror-0.2.1/service/get.go
--- old/helm-mirror-0.2.0/service/get.go        2018-12-04 12:00:48.000000000 
+0100
+++ new/helm-mirror-0.2.1/service/get.go        2019-01-03 15:12:28.000000000 
+0100
@@ -2,13 +2,11 @@
 
 import (
        "bytes"
-       "errors"
        "fmt"
        "io/ioutil"
        "log"
        "os"
        "path"
-       "strings"
 
        "k8s.io/helm/pkg/getter"
        "k8s.io/helm/pkg/helm/environment"
@@ -64,19 +62,28 @@
        }
 
        charts := chartRepo.IndexFile.Entries
-       var errs []string
        for n, c := range charts {
                for _, cc := range c {
                        for _, u := range cc.URLs {
                                b, err := chartRepo.Client.Get(u)
                                if err != nil {
-                                       errs = append(errs, err.Error())
+                                       if g.ignoreErrors {
+                                               g.logger.Printf("WARNING: 
processing chart %s(%s) - %s", cc.Name, cc.Version, err)
+                                               continue
+                                       } else {
+                                               return err
+                                       }
                                }
                                chartFileName := fmt.Sprintf("%s-%s.tgz", n, 
cc.Version)
                                chartPath := path.Join(g.config.Name, 
chartFileName)
                                err = writeFile(chartPath, b.Bytes(), g.logger)
                                if err != nil {
-                                       errs = append(errs, err.Error())
+                                       if g.ignoreErrors {
+                                               g.logger.Printf("WARNING: 
saving chart %s(%s) - %s", cc.Name, cc.Version, err)
+                                               continue
+                                       } else {
+                                               return err
+                                       }
                                }
                        }
                }
@@ -84,11 +91,7 @@
 
        err = prepareIndexFile(g.config.Name, g.config.URL, g.newRootURL, 
g.logger)
        if err != nil {
-               errs = append(errs, err.Error())
-       }
-
-       if len(errs) > 0 && !g.ignoreErrors {
-               return errors.New(strings.Join(errs, "\n"))
+               return err
        }
        return nil
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/helm-mirror-0.2.0/service/get_test.go 
new/helm-mirror-0.2.1/service/get_test.go
--- old/helm-mirror-0.2.0/service/get_test.go   2018-12-04 12:00:48.000000000 
+0100
+++ new/helm-mirror-0.2.1/service/get_test.go   2019-01-03 15:12:28.000000000 
+0100
@@ -3,13 +3,14 @@
 import (
        "io/ioutil"
        "log"
-       "net/http"
        "os"
        "path"
        "reflect"
        "strings"
        "testing"
 
+       "github.com/openSUSE/helm-mirror/fixtures"
+
        "k8s.io/helm/pkg/repo"
 )
 
@@ -59,7 +60,8 @@
                t.Errorf("loading testdata: %s", err)
        }
        defer os.RemoveAll(dir)
-       svr := startHTTPServer()
+       svr := fixtures.StartHTTPServer()
+       fixtures.WaitForServer(svr.Addr)
        type fields struct {
                repoURL      string
                workDir      string
@@ -74,7 +76,8 @@
                {"1", fields{"", "", false, false}, true},
                {"2", fields{"http://127.0.0.1";, "", false, false}, true},
                {"3", fields{"http://127.0.0.1:1793";, "", false, false}, true},
-               {"4", fields{"http://127.0.0.1:1793";, path.Join(dir, "get"), 
false, false}, false},
+               {"4", fields{"http://127.0.0.1:1793";, path.Join(dir, "get"), 
false, false}, true},
+               {"5", fields{"http://127.0.0.1:1793";, path.Join(dir, "get"), 
true, false}, false},
        }
        for _, tt := range tests {
                t.Run(tt.name, func(t *testing.T) {
@@ -119,30 +122,6 @@
        os.RemoveAll("tmp.txt")
 }
 
-func startHTTPServer() *http.Server {
-       srv := &http.Server{Addr: ":1793"}
-       http.HandleFunc("/index.yaml", indexFile)
-       http.HandleFunc("/chart1-2.11.0.tgz", chartTgz)
-       http.HandleFunc("/chart2-1.0.1.tgz", chartTgz)
-       http.HandleFunc("/chart2-0.0.0-pre.tgz", chartTgz)
-       go func() {
-               if err := srv.ListenAndServe(); err != nil {
-                       log.Printf("Httpserver: ListenAndServe() error: %s", 
err)
-               }
-       }()
-       return srv
-}
-
-func indexFile(w http.ResponseWriter, r *http.Request) {
-       w.Header().Set("Content-Type", "binary/octet-stream")
-       w.Write([]byte(indexYaml))
-}
-
-func chartTgz(w http.ResponseWriter, r *http.Request) {
-       w.Header().Set("Content-Type", "binary/octet-stream")
-       w.Write(chartTGZ)
-}
-
 func Test_prepareIndexFile(t *testing.T) {
        dir, err := prepareTmp()
        if err != nil {
@@ -165,7 +144,7 @@
                {"3", args{path.Join(dir, "processfolder"), 
"http://127.0.0.1:1793";, "", fakeLogger}, false},
        }
        for _, tt := range tests {
-               ioutil.WriteFile(path.Join(dir, "processfolder", 
"downloaded-index.yaml"), []byte(indexYaml), 0666)
+               ioutil.WriteFile(path.Join(dir, "processfolder", 
"downloaded-index.yaml"), []byte(fixtures.IndexYaml), 0666)
                t.Run(tt.name, func(t *testing.T) {
                        if err := prepareIndexFile(tt.args.folder, tt.args.URL, 
tt.args.newRootURL, tt.args.log); (err != nil) != tt.wantErr {
                                t.Errorf("prepareIndexFile() error = %v, 
wantErr %v", err, tt.wantErr)
@@ -177,7 +156,7 @@
                                }
                                content := string(contentBytes)
                                count := strings.Count(content, 
tt.args.newRootURL)
-                               if count != 3 {
+                               if count != fixtures.Expectedcharts {
                                        t.Errorf("prepareIndexFile() 
replacedCount = %v, want replacedCount %v", count, 3)
                                }
                                _, err = os.Stat(path.Join(dir, 
"processfolder", "downloaded-index.yaml"))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/helm-mirror-0.2.0/service/mocks_test.go 
new/helm-mirror-0.2.1/service/mocks_test.go
--- old/helm-mirror-0.2.0/service/mocks_test.go 2018-12-04 12:00:48.000000000 
+0100
+++ new/helm-mirror-0.2.1/service/mocks_test.go 2019-01-03 15:12:28.000000000 
+0100
@@ -18,36 +18,6 @@
        return nil
 }
 
-var indexYaml = `apiVersion: v1
-entries:
-  chart1:
-  - apiVersion: v2
-    created: 2018-09-20T00:00:00.000000000Z
-    description: A Helm chart for testing
-    digest: 8cc99f9cb669171776f7c6ec66069907579be91179f9201725fc6fc6f9ef1f29
-    name: chart1
-    urls:
-    - http://127.0.0.1:1793/chart1-2.11.0.tgz
-    version: 2.11.0
-  chart2:
-  - apiVersion: v1
-    created: 2018-09-20T00:00:00.000000000Z
-    description: A Helm chart for testing too
-    digest: 0c76ee9b4b78cb60fcce8c00ec0f5048cbe626fcaabe48f2f8e84b029e894f49
-    name: chart2
-    urls:
-    - http://127.0.0.1:1793/chart2-1.0.1.tgz
-    version: 1.0.1
-  - apiVersion: v1
-    created: 2018-09-20T00:00:00.000000000Z
-    description: A Helm chart for testing too
-    digest: e9a545006570b7fc5e4458f6eae178c2aa8f8e9e57eafac59869c856b86e862f
-    name: chart2
-    urls:
-    - http://127.0.0.1:1793/chart2-0.0.0-pre.tgz
-    version: 0.0.0-pre
-`
-
 var valuesYaml = `---
 kube:
   external_ips: []
@@ -62,6 +32,3 @@
 image: "opensuse"
 version: "42"
 `
-
-var chartTGZ = []byte{31, 139, 8, 0, 224, 223, 181, 91, 0, 3, 237, 193, 1, 13, 
0, 0, 0, 194,
-       160, 247, 79, 109, 14, 55, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 55, 3, 
154, 222, 29, 39, 0, 40, 0, 0}


Reply via email to