Skip to content

Instantly share code, notes, and snippets.

@jmrodri
Created October 6, 2020 21:46
Show Gist options
  • Save jmrodri/a48d34795f4a0364baee1294abc54339 to your computer and use it in GitHub Desktop.
Save jmrodri/a48d34795f4a0364baee1294abc54339 to your computer and use it in GitHub Desktop.
Your ansible memcached Generate would turn into this
// GenerateMemcachedAnsibleSample will call all actions to create the directory and generate the sample
// The Context to run the samples are not the same in the e2e test. In this way, note that it should NOT
// be called in the e2e tests since it will call the Prepare() to set the sample context and generate the files
// in the testdata directory. The e2e tests only ought to use the Run() method with the TestContext.
func GenerateMemcachedAnsibleSample(samplesPath string) {
ctx, err := pkg.NewSampleContext(testutils.BinaryName,
pkg.WithPath(filepath.Join(samplesPath, "ansible/memcached-operator")),
pkg.WithEnvironment("GO111MODULE=on"),
)
pkg.CheckError("generating ansible memcached context", err)
memcached := NewMemcachedAnsible(&ctx)
memcached.Prepare()
memcached.Run()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment