本文整理汇总了Golang中launchpad/net/gocheck.C.Skip方法的典型用法代码示例。如果您正苦于以下问题:Golang C.Skip方法的具体用法?Golang C.Skip怎么用?Golang C.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类launchpad/net/gocheck.C
的用法示例。
在下文中一共展示了C.Skip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SetUpTest
func (s *LibVertSuite) SetUpTest(c *gc.C) {
s.BaseSuite.SetUpTest(c)
// Skip if not linux
if runtime.GOOS != "linux" {
c.Skip("not running linux")
}
}
示例2: TestImportKeysInvalidUser
func (s *keymanagerSuite) TestImportKeysInvalidUser(c *gc.C) {
c.Skip("no user validation done yet")
s.assertInvalidUserOperation(c, func(user string, keys []string) error {
_, err := s.keymanager.ImportKeys(user, keys...)
return err
})
}
示例3: SetUpSuite
func (s *AmazonClientSuite) SetUpSuite(c *gocheck.C) {
if !testutil.Amazon {
c.Skip("AmazonClientSuite tests not enabled")
}
s.srv.SetUp(c)
s.ec2 = ec2.New(s.srv.auth, aws.USEast)
}
示例4: TestDeleteKeysInvalidUser
func (s *keyManagerSuite) TestDeleteKeysInvalidUser(c *gc.C) {
c.Skip("no user validation done yet")
s.assertInvalidUserOperation(c, func(args params.ModifyUserSSHKeys) error {
_, err := s.keymanager.DeleteKeys(args)
return err
})
}
示例5: TestSimpleInstallWithEnv
func (s *IntegrationTestSuite) TestSimpleInstallWithEnv(c *chk.C) {
if !*hasEnvFile {
c.Skip("-env-file not specified")
}
id, err := containers.NewIdentifier("IntTest008")
c.Assert(err, chk.IsNil)
s.containerIds = append(s.containerIds, id)
hostContainerId := fmt.Sprintf("%v/%v", s.daemonURI, id)
cmd := exec.Command("/usr/bin/gear", "install", EnvImage, hostContainerId, "--env-file=deployment/fixtures/simple.env", "--start")
data, err := cmd.CombinedOutput()
c.Log(cmd.Args)
c.Log(string(data))
c.Assert(err, chk.IsNil)
time.Sleep(time.Second * 5) // startup time is indeterminate unfortunately because gear init --post continues to run
cmd = exec.Command("/usr/bin/gear", "status", hostContainerId)
data, err = cmd.CombinedOutput()
c.Assert(err, chk.IsNil)
c.Log(string(data))
c.Assert(strings.Contains(string(data), "TEST=\"value\""), chk.Equals, true)
c.Assert(strings.Contains(string(data), "QUOTED=\"foo\""), chk.Equals, true)
}
示例6: TestKeyError
func (*testWrapper) TestKeyError(c *C.C) {
cwd, err := os.Getwd()
if err != nil {
c.Skip(err.Error())
}
var errs sectionErrors
data := make(connectionData)
addSettingSection(data, section8021x)
// check 8021x cert file
errs = make(sectionErrors)
logicSetSettingVk8021xCaCert(data, cwd+"/testdata/ca.crt")
checkSetting8021xCaCert(data, errs)
c.Check(len(errs), C.Equals, 0)
errs = make(sectionErrors)
logicSetSettingVk8021xCaCert(data, cwd+"/testdata/ca.crt.notexists")
checkSetting8021xCaCert(data, errs)
c.Check(len(errs), C.Equals, 1)
errs = make(sectionErrors)
logicSetSettingVk8021xCaCert(data, "abc"+cwd+"/testdata/ca.crt")
checkSetting8021xCaCert(data, errs)
c.Check(len(errs), C.Equals, 1)
}
示例7: TestSimpleInstallWithEnv
func (s *IntegrationTestSuite) TestSimpleInstallWithEnv(c *chk.C) {
if !*hasEnvFile {
c.Skip("-env-file not specified")
}
id, err := containers.NewIdentifier("IntTest008")
c.Assert(err, chk.IsNil)
s.containerIds = append(s.containerIds, id)
hostContainerId := fmt.Sprintf("%v/%v", s.daemonURI, id)
cmd := exec.Command("/usr/bin/gear", "install", EnvImage, hostContainerId, "--env-file=deployment/fixtures/simple.env", "--start")
data, err := cmd.CombinedOutput()
c.Log(cmd.Args)
c.Log(string(data))
c.Assert(err, chk.IsNil)
s.assertContainerStarts(c, id)
cmd = exec.Command("/usr/bin/gear", "status", hostContainerId)
data, err = cmd.CombinedOutput()
c.Assert(err, chk.IsNil)
c.Log(string(data))
c.Assert(strings.Contains(string(data), "TEST=\"value\""), chk.Equals, true)
c.Assert(strings.Contains(string(data), "QUOTED=\"\\\"foo\\\"\""), chk.Equals, true)
c.Assert(strings.Contains(string(data), "IGNORED"), chk.Equals, false)
cmd = exec.Command("/usr/bin/gear", "stop", hostContainerId)
data, err = cmd.CombinedOutput()
c.Log(string(data))
c.Assert(err, chk.IsNil)
s.assertContainerStops(c, id, true)
}
示例8: TestHash
// Tests
func (s *S) TestHash(c *check.C) {
var (
err error
f *os.File
md5hash []byte
)
// FIXME: This will not work with MacOS.
if _, err = exec.LookPath("md5sum"); err != nil {
c.Skip(err.Error())
}
md5sum := exec.Command("md5sum", "./files_test.go")
b := &bytes.Buffer{}
md5sum.Stdout = b
if err = md5sum.Run(); err != nil {
c.Fatal(err)
}
if f, err = os.Open("./files_test.go"); err != nil {
c.Fatalf("%v %s", md5sum, err)
}
if md5hash, err = Hash(md5.New(), f); err != nil {
c.Fatal(err)
}
md5string := fmt.Sprintf("%x .*\n", md5hash)
c.Check(string(b.Bytes()), check.Matches, md5string)
}
示例9: TestProxyCommand
func (s *SSHGoCryptoCommandSuite) TestProxyCommand(c *gc.C) {
realNetcat, err := exec.LookPath("nc")
if err != nil {
c.Skip("skipping test, couldn't find netcat: %v")
return
}
netcat := filepath.Join(c.MkDir(), "nc")
err = ioutil.WriteFile(netcat, []byte("#!/bin/sh\necho $0 \"[email protected]\" > $0.args && exec "+realNetcat+" \"[email protected]\""), 0755)
c.Assert(err, gc.IsNil)
private, _, err := ssh.GenerateKey("test-server")
c.Assert(err, gc.IsNil)
key, err := cryptossh.ParsePrivateKey([]byte(private))
client, err := ssh.NewGoCryptoClient(key)
c.Assert(err, gc.IsNil)
server := newServer(c)
var opts ssh.Options
port := server.listener.Addr().(*net.TCPAddr).Port
opts.SetProxyCommand(netcat, "-q0", "%h", "%p")
opts.SetPort(port)
cmd := client.Command("127.0.0.1", testCommand, &opts)
server.cfg.PublicKeyCallback = func(_ cryptossh.ConnMetadata, pubkey cryptossh.PublicKey) (*cryptossh.Permissions, error) {
return nil, nil
}
go server.run(c)
out, err := cmd.Output()
c.Assert(err, gc.IsNil)
c.Assert(string(out), gc.Equals, "abc value\n")
// Ensure the proxy command was executed with the appropriate arguments.
data, err := ioutil.ReadFile(netcat + ".args")
c.Assert(err, gc.IsNil)
c.Assert(string(data), gc.Equals, fmt.Sprintf("%s -q0 127.0.0.1 %v\n", netcat, port))
}
示例10: TestCheckEnvironmentOnConnectBadVerificationFile
func (t *LiveTests) TestCheckEnvironmentOnConnectBadVerificationFile(c *gc.C) {
// When new connection is established to a bootstraped environment,
// it is checked that we are running against a juju-core environment.
//
// If the verification file has unexpected content, it is not
// a juju-core environment (likely to a Python juju environment).
if !t.CanOpenState {
c.Skip("CanOpenState is false; cannot open state connection")
}
t.BootstrapOnce(c)
environ := t.Env
stor := environ.Storage()
// Finally, replace the content with an arbitrary string.
badVerificationContent := "bootstrap storage verification"
reader := strings.NewReader(badVerificationContent)
err := stor.Put(
"bootstrap-verify",
reader,
int64(len(badVerificationContent)))
c.Assert(err, gc.IsNil)
defer restoreBootstrapVerificationFile(c, stor)
// Running NewConn() should fail.
_, err = juju.NewConn(t.Env)
c.Assert(err, gc.Equals, environs.InvalidEnvironmentError)
}
示例11: SetUpSuite
func (s *AmazonServerSuite) SetUpSuite(c *gocheck.C) {
if !*amazon {
c.Skip("AmazonServerSuite tests not enabled")
}
s.srv.SetUp(c)
s.ServerTests.elb = elb.New(s.srv.auth, aws.USEast)
}
示例12: TestStatsCounter
func (s *StoreSuite) TestStatsCounter(c *gc.C) {
if *noTestMongoJs {
c.Skip("MongoDB javascript not available")
}
for _, key := range [][]string{{"a", "b"}, {"a", "b"}, {"a", "c"}, {"a"}} {
err := s.store.IncCounter(key)
c.Assert(err, gc.IsNil)
}
server, _ := s.prepareServer(c)
expected := map[string]string{
"a:b": "2",
"a:b:*": "0",
"a:*": "3",
"a": "1",
"a:b:c": "0",
}
for counter, n := range expected {
req, err := http.NewRequest("GET", "/stats/counter/"+counter, nil)
c.Assert(err, gc.IsNil)
rec := httptest.NewRecorder()
server.ServeHTTP(rec, req)
data, err := ioutil.ReadAll(rec.Body)
c.Assert(string(data), gc.Equals, n)
c.Assert(rec.Header().Get("Content-Type"), gc.Equals, "text/plain")
c.Assert(rec.Header().Get("Content-Length"), gc.Equals, strconv.Itoa(len(n)))
}
}
示例13: TestProxyCommand
func (s *SSHGoCryptoCommandSuite) TestProxyCommand(c *gc.C) {
realNetcat, err := exec.LookPath("nc")
if err != nil {
c.Skip("skipping test, couldn't find netcat: %v")
return
}
netcat := filepath.Join(c.MkDir(), "nc")
err = ioutil.WriteFile(netcat, []byte("#!/bin/sh\necho $0 \"[email protected]\" > $0.args && exec "+realNetcat+" \"[email protected]\""), 0755)
c.Assert(err, gc.IsNil)
private, _, err := ssh.GenerateKey("test-server")
c.Assert(err, gc.IsNil)
key, err := cryptossh.ParsePrivateKey([]byte(private))
client, err := ssh.NewGoCryptoClient(key)
c.Assert(err, gc.IsNil)
server := newServer(c)
var opts ssh.Options
port := server.Addr().(*net.TCPAddr).Port
opts.SetProxyCommand(netcat, "-q0", "%h", "%p")
opts.SetPort(port)
cmd := client.Command("127.0.0.1", testCommand, &opts)
server.cfg.PublicKeyCallback = func(conn *cryptossh.ServerConn, user, algo string, pubkey []byte) bool {
return true
}
go server.run(c)
out, err := cmd.Output()
c.Assert(err, gc.ErrorMatches, "ssh: could not execute command.*")
// TODO(axw) when gosshnew is ready, expect reply from server.
c.Assert(out, gc.IsNil)
// Ensure the proxy command was executed with the appropriate arguments.
data, err := ioutil.ReadFile(netcat + ".args")
c.Assert(err, gc.IsNil)
c.Assert(string(data), gc.Equals, fmt.Sprintf("%s -q0 127.0.0.1 %v\n", netcat, port))
}
示例14: TestListKeysErrors
func (s *keymanagerSuite) TestListKeysErrors(c *gc.C) {
c.Skip("the user name isn't checked for existence yet")
keyResults, err := s.keymanager.ListKeys(ssh.Fingerprints, "invalid")
c.Assert(err, gc.IsNil)
c.Assert(len(keyResults), gc.Equals, 1)
result := keyResults[0]
c.Assert(result.Error, gc.ErrorMatches, `permission denied`)
}
示例15: TestBootstrapWithDefaultSeries
func (t *LiveTests) TestBootstrapWithDefaultSeries(c *gc.C) {
if !t.HasProvisioner {
c.Skip("HasProvisioner is false; cannot test deployment")
}
current := version.Current
other := current
other.Series = "quantal"
if current == other {
other.Series = "precise"
}
dummyCfg, err := config.New(config.NoDefaults, dummy.SampleConfig().Merge(coretesting.Attrs{
"state-server": false,
"name": "dummy storage",
}))
dummyenv, err := environs.Prepare(dummyCfg, coretesting.Context(c), configstore.NewMem())
c.Assert(err, gc.IsNil)
defer dummyenv.Destroy()
t.Destroy(c)
attrs := t.TestConfig.Merge(coretesting.Attrs{"default-series": other.Series})
cfg, err := config.New(config.NoDefaults, attrs)
c.Assert(err, gc.IsNil)
env, err := environs.Prepare(cfg, coretesting.Context(c), t.ConfigStore)
c.Assert(err, gc.IsNil)
defer environs.Destroy(env, t.ConfigStore)
currentName := envtools.StorageName(current)
otherName := envtools.StorageName(other)
envStorage := env.Storage()
dummyStorage := dummyenv.Storage()
defer envStorage.Remove(otherName)
_, err = sync.Upload(dummyStorage, ¤t.Number)
c.Assert(err, gc.IsNil)
// This will only work while cross-compiling across releases is safe,
// which depends on external elements. Tends to be safe for the last
// few releases, but we may have to refactor some day.
err = storageCopy(dummyStorage, currentName, envStorage, otherName)
c.Assert(err, gc.IsNil)
err = bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{})
c.Assert(err, gc.IsNil)
st := t.Env.(testing.GetStater).GetStateInAPIServer()
// Wait for machine agent to come up on the bootstrap
// machine and ensure it deployed the proper series.
m0, err := st.Machine("0")
c.Assert(err, gc.IsNil)
mw0 := newMachineToolWaiter(m0)
defer mw0.Stop()
waitAgentTools(c, mw0, other)
}