1
0
Fork 0
mirror of https://github.com/Luzifer/duplicity-backup.git synced 2024-11-08 15:10:06 +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
test:
ginkgo
gometalinter \
--cyclo-over=15 \
--deadline=20s \
--exclude=bindata.go \
--exclude=configfile_test.go \
-D errcheck
go test -v
install:
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"`
Include []string `yaml:"inclist"`
Exclude []string `yaml:"exclist"`
IncExcFile string `yaml:"incexcfile" valid:"customFileExistsValidator,required"`
IncExcFile string `yaml:"incexcfile" valid:"customFileExistsValidator"`
ExcludeDeviceFiles bool `yaml:"excdevicefiles"`
Encryption struct {
Enable bool `yaml:"enable"`

View file

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

View file

@ -39,8 +39,7 @@ var (
)
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")
}
@ -55,6 +54,7 @@ func initCFG() {
log.Fatalf("Unable to parse log level: %s", err)
}
var err error
if cfg.ConfigFile, err = homedir.Expand(cfg.ConfigFile); err != nil {
log.WithError(err).Fatal("Unable to expand config-file")
}
@ -101,7 +101,7 @@ func main() {
}
// 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")
}