Skip to content

Instantly share code, notes, and snippets.

@karampok
Created February 7, 2017 09:31
Show Gist options
  • Save karampok/d75116097d6a3d9e25b9959e517616c7 to your computer and use it in GitHub Desktop.
Save karampok/d75116097d6a3d9e25b9959e517616c7 to your computer and use it in GitHub Desktop.
Test GDN stop with long process
var _ = FDescribe("DEBUG", func() {
var (
client *runner.RunningGarden
args []string
)
BeforeEach(func() {
// we need to pass --properties-path to prevent guardian from deleting containers
// after restarting the server
propertiesDir, err := ioutil.TempDir("", "props")
Expect(err).NotTo(HaveOccurred())
args = []string{"--properties-path", path.Join(propertiesDir, "props.json")}
client = startGarden(args...)
})
FContext("stop GDN when there is a long-lived process", func() {
BeforeEach(func() {
container, err := client.Create(garden.ContainerSpec{})
Expect(err).NotTo(HaveOccurred())
_, err = container.Run(garden.ProcessSpec{
Path: "sh",
Args: []string{"-c", ` sleep 1000 `}},
garden.ProcessIO{})
Expect(err).NotTo(HaveOccurred())
})
It("GDN server should not run", func() {
time.Sleep(time.Hour)
Expect(client.Stop()).Should(Succeed())
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment