forked from toolshed/abra
test: int suite fixes
This commit is contained in:
@ -576,6 +576,7 @@ func (a App) WriteRecipeVersion(version string) error {
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
skipped := false
|
||||
scanner := bufio.NewScanner(file)
|
||||
lines := []string{}
|
||||
for scanner.Scan() {
|
||||
@ -590,6 +591,12 @@ func (a App) WriteRecipeVersion(version string) error {
|
||||
continue
|
||||
}
|
||||
|
||||
if strings.Contains(line, version) {
|
||||
skipped = true
|
||||
lines = append(lines, line)
|
||||
continue
|
||||
}
|
||||
|
||||
splitted := strings.Split(line, ":")
|
||||
line = fmt.Sprintf("%s:%s", splitted[0], version)
|
||||
lines = append(lines, line)
|
||||
@ -603,7 +610,11 @@ func (a App) WriteRecipeVersion(version string) error {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Infof("version %s saved to %s.env", version, a.Domain)
|
||||
if !skipped {
|
||||
log.Infof("version %s saved to %s.env", version, a.Domain)
|
||||
} else {
|
||||
log.Debugf("skipping version %s write as already exists in %s.env", version, a.Domain)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ func ToJSON(headers []string, rows [][]string) (string, error) {
|
||||
|
||||
buff.Write([]byte("["))
|
||||
|
||||
for _, row := range rows {
|
||||
for idx, row := range rows {
|
||||
payload := make(map[string]string)
|
||||
|
||||
for idx, header := range headers {
|
||||
@ -82,6 +82,10 @@ func ToJSON(headers []string, rows [][]string) (string, error) {
|
||||
}
|
||||
|
||||
buff.Write(serialized)
|
||||
|
||||
if idx < (len(rows) - 1) {
|
||||
buff.Write([]byte(","))
|
||||
}
|
||||
}
|
||||
|
||||
buff.Write([]byte("]"))
|
||||
|
@ -26,21 +26,26 @@ func (r Recipe) Ensure(chaos bool, offline bool) error {
|
||||
if err := r.EnsureIsClean(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !offline {
|
||||
if err := r.EnsureUpToDate(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
if r.Version != "" {
|
||||
log.Debugf("ensuring version %s", r.Version)
|
||||
if _, err := r.EnsureVersion(r.Version); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := r.EnsureLatest(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := r.EnsureLatest(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user