-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stability: use fault-trigger at e2e tests and add some log #330
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
nodes: | ||
- physical_node: 172.16.4.39 | ||
nodes: | ||
- 172.16.4.171 | ||
- 172.16.4.172 | ||
- 172.16.4.173 | ||
- physical_node: 172.16.4.40 | ||
nodes: | ||
- 172.16.4.174 | ||
- 172.16.4.175 | ||
- 172.16.4.176 | ||
etcds: | ||
- physical_node: 172.16.4.39 | ||
nodes: | ||
- 172.16.4.171 | ||
- 172.16.4.172 | ||
- 172.16.4.173 | ||
apiservers: | ||
- physical_node: 172.16.4.39 | ||
nodes: | ||
- 172.16.4.171 | ||
- 172.16.4.172 | ||
- 172.16.4.173 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package tests | ||
|
||
import ( | ||
"flag" | ||
"io/ioutil" | ||
|
||
"github.com/pingcap/errors" | ||
yaml "gopkg.in/yaml.v2" | ||
) | ||
|
||
// Config defines the config of operator tests | ||
type Config struct { | ||
*flag.FlagSet `json:"-"` | ||
|
||
configFile string | ||
|
||
LogDir string `yaml:"log_dir" json:"log_dir"` | ||
FaultTriggerPort int `yaml:"fault_trigger_port" json:"fault_trigger_port"` | ||
Nodes []Nodes `yaml:"nodes" json:"nodes"` | ||
ETCDs []Nodes `yaml:"etcds" json:"etcds"` | ||
APIServers []Nodes `yaml:"apiservers" json:"apiservers"` | ||
} | ||
|
||
// Nodes defines a series of nodes that belong to the same physical node. | ||
type Nodes struct { | ||
PhysicalNode string `yaml:"physical_node" json:"physical_node"` | ||
Nodes []string `yaml:"nodes" json:"nodes"` | ||
} | ||
|
||
// NewConfig creates a new config. | ||
func NewConfig() *Config { | ||
cfg := &Config{} | ||
cfg.FlagSet = flag.CommandLine | ||
|
||
fs := cfg.FlagSet | ||
|
||
fs.StringVar(&cfg.configFile, "config", "/etc/e2e/config.yaml", "Config file") | ||
fs.StringVar(&cfg.LogDir, "log-dir", "/logDir", "log directory") | ||
fs.IntVar(&cfg.FaultTriggerPort, "fault-trigger-port", 23332, "the http port of fault trigger service") | ||
|
||
return cfg | ||
} | ||
|
||
// Parse parses flag definitions from the argument list. | ||
func (c *Config) Parse(args []string) error { | ||
// Parse first to get config file | ||
err := c.FlagSet.Parse(args) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if c.configFile != "" { | ||
if err = c.configFromFile(c.configFile); err != nil { | ||
return err | ||
} | ||
} | ||
|
||
// Parse again to replace with command line options. | ||
err = c.FlagSet.Parse(args) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if len(c.FlagSet.Args()) != 0 { | ||
return errors.Errorf("'%s' is an invalid flag", c.FlagSet.Arg(0)) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (c *Config) configFromFile(path string) error { | ||
data, err := ioutil.ReadFile(path) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if err = yaml.Unmarshal(data, c); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this file?