1
0
Fork 0
mirror of https://github.com/Luzifer/duplicity-backup.git synced 2024-12-20 18:41:21 +00:00

Fix tests

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-10-08 16:52:45 +02:00
parent c315e35161
commit c6d5a68e2b
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
4 changed files with 6 additions and 14 deletions

View file

@ -14,13 +14,7 @@ setup-testenv:
gometalinter --install --update gometalinter --install --update
test: test:
ginkgo go test -v
gometalinter \
--cyclo-over=15 \
--deadline=20s \
--exclude=bindata.go \
--exclude=configfile_test.go \
-D errcheck
install: install:
go install -a -ldflags "-X main.version=$(shell git describe --tags || git rev-parse --short HEAD || echo dev)" go install -a -ldflags "-X main.version=$(shell git describe --tags || git rev-parse --short HEAD || echo dev)"

View file

@ -63,7 +63,7 @@ type configFile struct {
} `yaml:"swift"` } `yaml:"swift"`
Include []string `yaml:"inclist"` Include []string `yaml:"inclist"`
Exclude []string `yaml:"exclist"` Exclude []string `yaml:"exclist"`
IncExcFile string `yaml:"incexcfile" valid:"customFileExistsValidator,required"` IncExcFile string `yaml:"incexcfile" valid:"customFileExistsValidator"`
ExcludeDeviceFiles bool `yaml:"excdevicefiles"` ExcludeDeviceFiles bool `yaml:"excdevicefiles"`
Encryption struct { Encryption struct {
Enable bool `yaml:"enable"` Enable bool `yaml:"enable"`

View file

@ -2,7 +2,6 @@ package main
import ( import (
"bytes" "bytes"
"regexp"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
@ -30,7 +29,6 @@ logdir: /var/log/duplicity/
var ( var (
commandLine, env, argv []string commandLine, env, argv []string
logFilter *regexp.Regexp
loadErr, err error loadErr, err error
t string t string
cf *configFile cf *configFile
@ -42,7 +40,7 @@ logdir: /var/log/duplicity/
if loadErr != nil { if loadErr != nil {
panic(loadErr) panic(loadErr)
} }
commandLine, env, logFilter, err = cf.GenerateCommand(argv, t) commandLine, env, _, err = cf.GenerateCommand(argv, t)
}) })
Context("Backup with given config", func() { Context("Backup with given config", func() {

View file

@ -39,8 +39,7 @@ var (
) )
func initCFG() { func initCFG() {
var err error if err := rconfig.Parse(&cfg); err != nil {
if err = rconfig.Parse(&cfg); err != nil {
log.WithError(err).Fatal("Error while parsing arguments") log.WithError(err).Fatal("Error while parsing arguments")
} }
@ -55,6 +54,7 @@ func initCFG() {
log.Fatalf("Unable to parse log level: %s", err) log.Fatalf("Unable to parse log level: %s", err)
} }
var err error
if cfg.ConfigFile, err = homedir.Expand(cfg.ConfigFile); err != nil { if cfg.ConfigFile, err = homedir.Expand(cfg.ConfigFile); err != nil {
log.WithError(err).Fatal("Unable to expand config-file") log.WithError(err).Fatal("Unable to expand config-file")
} }
@ -101,7 +101,7 @@ func main() {
} }
// Initialize logfile // Initialize logfile
if err := os.MkdirAll(config.LogDirectory, 0750); err != nil { if err = os.MkdirAll(config.LogDirectory, 0750); err != nil {
log.WithError(err).Fatal("Unable to create log dir") log.WithError(err).Fatal("Unable to create log dir")
} }