mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 05:40:11 +01:00
Fix csaf_provider integration test
* Move to using a custom argument list in main for the provider, now that we have argument handling.
This commit is contained in:
parent
7a1d26e3fd
commit
b2ac115ee4
2 changed files with 9 additions and 5 deletions
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http/cgi"
|
"net/http/cgi"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/csaf-poc/csaf_distribution/util"
|
"github.com/csaf-poc/csaf_distribution/util"
|
||||||
"github.com/jessevdk/go-flags"
|
"github.com/jessevdk/go-flags"
|
||||||
|
|
@ -21,7 +22,7 @@ type options struct {
|
||||||
Version bool `long:"version" description:"Display version of the binary"`
|
Version bool `long:"version" description:"Display version of the binary"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func realMain(args []string) {
|
||||||
cfg, err := loadConfig()
|
cfg, err := loadConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("error: %v\n", err)
|
log.Fatalf("error: %v\n", err)
|
||||||
|
|
@ -29,7 +30,7 @@ func main() {
|
||||||
|
|
||||||
var opts options
|
var opts options
|
||||||
parser := flags.NewParser(&opts, flags.Default)
|
parser := flags.NewParser(&opts, flags.Default)
|
||||||
parser.Parse()
|
parser.ParseArgs(args)
|
||||||
if opts.Version {
|
if opts.Version {
|
||||||
fmt.Println(util.SemVersion)
|
fmt.Println(util.SemVersion)
|
||||||
return
|
return
|
||||||
|
|
@ -46,3 +47,7 @@ func main() {
|
||||||
log.Fatalf("error: %v\n", err)
|
log.Fatalf("error: %v\n", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
realMain(os.Args[1:])
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
// as main() does not process os.Args, we can call it directly as -test.*
|
// call realMain() with Args that skip over params used by "go test"
|
||||||
// parameters will be ignored.
|
|
||||||
//
|
//
|
||||||
// use like
|
// use like
|
||||||
// go test -c -vet=off -covermode=atomic -o csaf_provider.debug
|
// go test -c -vet=off -covermode=atomic -o csaf_provider.debug
|
||||||
|
|
@ -38,5 +37,5 @@ func TestMain(t *testing.T) {
|
||||||
if endOfTestParams == 0 {
|
if endOfTestParams == 0 {
|
||||||
t.Skip("skipping integration test, no `--` parameter found")
|
t.Skip("skipping integration test, no `--` parameter found")
|
||||||
}
|
}
|
||||||
main()
|
realMain(os.Args[endOfTestParams+1:])
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue