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:
parent
c315e35161
commit
c6d5a68e2b
4 changed files with 6 additions and 14 deletions
8
Makefile
8
Makefile
|
@ -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)"
|
||||||
|
|
|
@ -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"`
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
6
main.go
6
main.go
|
@ -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")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue