Last active
July 2, 2018 03:17
-
-
Save mitsutaka/98a0f11aa2713dc89d7b55d740cf53be to your computer and use it in GitHub Desktop.
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
package neco_test_test | |
import ( | |
. "github.com/cybozu-go/neco-test" | |
. "github.com/onsi/ginkgo" | |
. "github.com/onsi/gomega" | |
) | |
var _ = Describe("NecoTest", func() { | |
Describe("Test behavior of etcdpasswd", func() { | |
Context("etcdpasswd set start-uid 10000", func() { | |
It("should be successfully", func() { | |
stdout, stderr, err := RunOnRack0Boot("etcdpasswd", "set", "start-uid", "10000") | |
code := ExitCode(err) | |
Expect(code).To(BeZero()) | |
Expect(stdout.String()).To(BeEmpty()) | |
Expect(stderr.String()).To(BeEmpty()) | |
}) | |
}) | |
Context("etcdpasswd set start-gid 10000", func() { | |
It("should be successfully", func() { | |
stdout, stderr, err := RunOnRack0Boot("etcdpasswd", "set", "start-gid", "10000") | |
code := ExitCode(err) | |
Expect(code).To(BeZero()) | |
Expect(stdout.String()).To(BeEmpty()) | |
Expect(stderr.String()).To(BeEmpty()) | |
}) | |
}) | |
Context("etcdpasswd group add bob", func() { | |
It("should be successfully", func() { | |
stdout, stderr, err := RunOnRack0Boot("etcdpasswd", "group", "add", "bob") | |
code := ExitCode(err) | |
Expect(code).To(BeZero()) | |
Expect(stdout.String()).To(BeEmpty()) | |
Expect(stderr.String()).To(BeEmpty()) | |
}) | |
}) | |
Context("etcdpasswd user add -group bob bob", func() { | |
It("should be successfully", func() { | |
stdout, stderr, err := RunOnRack0Boot("etcdpasswd", "user", "add", "-group", "bob", "bob") | |
code := ExitCode(err) | |
Expect(code).To(BeZero()) | |
Expect(stdout.String()).To(BeEmpty()) | |
Expect(stderr.String()).To(BeEmpty()) | |
}) | |
}) | |
Context("etcdpasswd user list", func() { | |
It("should be successfully", func() { | |
stdout, stderr, err := RunOnRack0Boot("etcdpasswd", "user", "list") | |
code := ExitCode(err) | |
Expect(code).To(BeZero()) | |
Expect(stdout.String()).To(Equal("bob\n")) | |
Expect(stderr.String()).To(BeEmpty()) | |
}) | |
}) | |
Context("grep bob /etc/passwd", func() { | |
It("should be successfully", func() { | |
stdout, stderr, err := RunOnRack0Boot("grep", "bob", "/etc/passwd") | |
code := ExitCode(err) | |
Expect(code).To(BeZero()) | |
Expect(stdout.String()).To(MatchRegexp("bob:x:[0-9]*:[0-9]*::/home/bob:/bin/bash")) | |
Expect(stderr.String()).To(BeEmpty()) | |
}) | |
}) | |
Context("etcdpasswd user remove bob", func() { | |
It("should be successfully", func() { | |
stdout, stderr, err := RunOnRack0Boot("etcdpasswd", "user", "remove", "bob") | |
code := ExitCode(err) | |
Expect(code).To(BeZero()) | |
Expect(stdout.String()).To(BeEmpty()) | |
Expect(stderr.String()).To(BeEmpty()) | |
}) | |
}) | |
Context("etcdpasswd group remove bob", func() { | |
It("should be successfully", func() { | |
stdout, stderr, err := RunOnRack0Boot("etcdpasswd", "group", "remove", "bob") | |
code := ExitCode(err) | |
Expect(code).To(BeZero()) | |
Expect(stdout.String()).To(BeEmpty()) | |
Expect(stderr.String()).To(BeEmpty()) | |
}) | |
}) | |
Context("etcdpasswd user list", func() { | |
It("should be successfully", func() { | |
stdout, stderr, err := RunOnRack0Boot("etcdpasswd", "user", "list") | |
code := ExitCode(err) | |
Expect(code).To(BeZero()) | |
Expect(stdout.String()).To(BeEmpty()) | |
Expect(stderr.String()).To(BeEmpty()) | |
}) | |
}) | |
Context("grep bob /etc/passwd", func() { | |
It("should be successfully", func() { | |
stdout, stderr, err := RunOnRack0Boot("grep", "bob", "/etc/passwd") | |
code := ExitCode(err) | |
Expect(code).NotTo(BeZero()) | |
Expect(stdout.String()).To(BeEmpty()) | |
Expect(stderr.String()).To(BeEmpty()) | |
}) | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment