<commit_before>// Copyright 2017 tsuru authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package integration

import (
	"strconv"
	"sync"

	check "gopkg.in/check.v1"
)

type hookFunc func(c *check.C, env *Environment)

type CmdWithExp struct {
	C *Command
	E []Expected
}

type ExecFlow struct {
	provides []string
	requires []string
	matrix   map[string]string
	parallel bool
	forward  hookFunc
	backward hookFunc
}

func (f *ExecFlow) Rollback(c *check.C, env *Environment) {
	if f.backward == nil {
		return
	}
	f.forExpanded(env, func(e *Environment) {
		f.backward(c, e)
	})
}

func (f *ExecFlow) Run(c *check.C, env *Environment) {<commit_msg>integration: set dry run on rollback if no_rollback env is set<commit_after>// Copyright 2017 tsuru authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package integration

import (
	"strconv"
	"sync"

	check "gopkg.in/check.v1"
)

type hookFunc func(c *check.C, env *Environment)

type CmdWithExp struct {
	C *Command
	E []Expected
}

type ExecFlow struct {
	provides []string
	requires []string
	matrix   map[string]string
	parallel bool
	forward  hookFunc
	backward hookFunc
}

func (f *ExecFlow) Rollback(c *check.C, env *Environment) {
	if f.backward == nil {
		return
	}
	if noRollback, _ := strconv.ParseBool(env.Get("no_rollback")); noRollback {
		env.Set("dryrun", "true")
	}
	if noRollback, _ := strconv.ParseBool(env.Get("no_rollback_on_error")); c.Failed() && noRollback {
		env.Set("dryrun", "true")
	}
	f.forExpanded(env, func(e *Environment) {
		f.backward(c, e)
	})
}

func (f *ExecFlow) Run(c *check.C, env *Environment) {
{'fraction_non_alphanumeric': 0.12186788154897495, 'fraction_numerical': 0.0056947608200455585, 'mean_word_length': 4.078034682080925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6050592', 'n_tokens_mistral': 652, 'n_tokens_neox': 628, 'n_words': 193}