forked from elastic/elastic-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
34 lines (26 loc) · 885 Bytes
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.
package main
// This file is mandatory as otherwise the agent.test binary is not generated correctly.
import (
"flag"
"testing"
"github.com/spf13/cobra"
)
var systemTest *bool
func init() {
testing.Init()
cmd := &cobra.Command{
Use: "elastic-agent [subcommand]",
}
systemTest = flag.Bool("systemTest", false, "Set to true when running system tests")
cmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("systemTest"))
cmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("test.coverprofile"))
}
// Test started when the test binary is started. Only calls main.
func TestSystem(t *testing.T) {
if *systemTest {
main()
}
}