本文整理匯總了Golang中github.com/nyarly/testify/assert.NotNil函數的典型用法代碼示例。如果您正苦於以下問題:Golang NotNil函數的具體用法?Golang NotNil怎麽用?Golang NotNil使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NotNil函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestInvokeServer
func TestInvokeServer(t *testing.T) {
exe := justCommand(t, []string{`sous`, `server`})
assert.NotNil(t, exe)
exe = justCommand(t, []string{`sous`, `server`, `-cluster`, `test`})
assert.NotNil(t, exe)
}
示例2: TestInvokeManifestSet
func TestInvokeManifestSet(t *testing.T) {
assert := assert.New(t)
require := require.New(t)
exe := justCommand(t, []string{`sous`, `manifest`, `set`, `-repo`, `github.com/opentable/sous`})
assert.NotNil(exe)
maniSet, good := exe.Cmd.(*SousManifestSet)
require.True(good)
assert.NotNil(maniSet.StateWriter)
}
示例3: TestInvokeMetadataSet
func TestInvokeMetadataSet(t *testing.T) {
assert := assert.New(t)
require := require.New(t)
exe := justCommand(t, []string{`sous`, `metadata`, `set`, `-repo`, `github.com/opentable/sous`, `BuildBranch`, `master`})
assert.NotNil(exe)
metaSet, good := exe.Cmd.(*SousMetadataSet)
require.True(good)
assert.NotNil(metaSet.State)
}
示例4: TestInvokeQuery
func TestInvokeQuery(t *testing.T) {
assert := assert.New(t)
exe := justCommand(t, []string{`sous`, `query`})
assert.NotNil(exe)
exe = justCommand(t, []string{`sous`, `query`, `ads`})
assert.NotNil(exe)
exe = justCommand(t, []string{`sous`, `query`, `gdm`})
assert.NotNil(exe)
}
示例5: TestInvokeBuildWithRepoSelector
/*
usage: sous build [path]
build builds the project in your current directory by default. If you pass it a
path, it will instead build the project at that path.
options:
-offset string
source code relative repository offset
-repo string
source code repository location
-revision string
source code revision ID
-strict
require that the build be pristine
-tag string
source code revision tag
*/
func TestInvokeBuildWithRepoSelector(t *testing.T) {
assert := assert.New(t)
_, exe, _, _ := prepareCommand(t, []string{`sous`, `build`, `-repo`, `github.com/opentable/sous`})
assert.Len(exe.Args, 0)
build := exe.Cmd.(*SousBuild)
assert.NotNil(build.Labeller)
assert.NotNil(build.Registrar)
assert.Equal(build.DeployFilterFlags.Repo, `github.com/opentable/sous`)
}
示例6: TestInvokeHarvest
func TestInvokeHarvest(t *testing.T) {
assert := assert.New(t)
exe := justCommand(t, []string{`sous`, `harvest`, `sms-continual-test`})
assert.NotNil(exe)
assert.Len(exe.Args, 1)
}
示例7: TestInvokeConfig
/*
usage: sous config Invoking sous config with no arguments lists all configuration key/value pairs.
If you pass just a single argument (a key) sous config will output just the
value of that key. You can set a key by providing both a key and a value.
usage: sous config [<key> [value]]
*/
func TestInvokeConfig(t *testing.T) {
assert := assert.New(t)
exe := justCommand(t, []string{`sous`, `config`})
assert.NotNil(exe)
assert.Len(exe.Args, 0)
exe = justCommand(t, []string{`sous`, `config`, `x`})
assert.NotNil(exe)
assert.Len(exe.Args, 1)
exe = justCommand(t, []string{`sous`, `config`, `x`, `7`})
assert.NotNil(exe)
assert.Len(exe.Args, 2)
}
示例8: TestInvokeUpdate
func TestInvokeUpdate(t *testing.T) {
assert := assert.New(t)
exe := justCommand(t, []string{`sous`, `update`})
assert.NotNil(exe)
assert.Len(exe.Args, 0)
}
示例9: TestInvokeContext
/*
usage: sous context
context prints out sous's view of your current context
*/
func TestInvokeContext(t *testing.T) {
assert := assert.New(t)
exe := justCommand(t, []string{`sous`, `context`})
assert.NotNil(exe)
assert.Len(exe.Args, 0)
}
示例10: TestCanMakeAnAgent
func TestCanMakeAnAgent(t *testing.T) {
assert := assert.New(t)
agent, err := NewAgent()
assert.NoError(err)
assert.NotNil(agent)
}
示例11: TestNewClient
// This test is terrible, but the current design of the client is hard to test
func TestNewClient(t *testing.T) {
assert := assert.New(t)
c := NewClient()
assert.NotNil(c)
c.Cancel()
}
示例12: TestInvokeRectifyWithDebugFlags
func TestInvokeRectifyWithDebugFlags(t *testing.T) {
assert := assert.New(t)
require := require.New(t)
_, exe, _, stderr := prepareCommand(t, []string{`sous`, `rectify`, `-d`, `-v`, `-all`})
assert.Len(exe.Args, 0)
require.IsType(&SousRectify{}, exe.Cmd)
rect := exe.Cmd.(*SousRectify)
assert.NotNil(rect.Config)
assert.NotNil(rect.GDM)
require.NotNil(rect.SourceFlags)
assert.Equal(rect.SourceFlags.All, true)
assert.Regexp(`Verbose debugging`, stderr.String())
assert.Regexp(`Regular debugging`, stderr.String())
}
示例13: TestInvokeRectifyWithoutFilterFlags
func TestInvokeRectifyWithoutFilterFlags(t *testing.T) {
assert := assert.New(t)
require := require.New(t)
_, exe, _, _ := prepareCommand(t, []string{`sous`, `rectify`})
assert.Len(exe.Args, 0)
require.IsType(&SousRectify{}, exe.Cmd)
rect := exe.Cmd.(*SousRectify)
assert.NotNil(rect.Config)
assert.NotNil(rect.GDM)
require.NotNil(rect.SourceFlags)
assert.Equal(rect.SourceFlags.All, false)
require.NotNil(rect.Resolver.ResolveFilter)
assert.Equal(rect.Resolver.ResolveFilter.All(), true)
}
示例14: TestGetDepSetWorks
func TestGetDepSetWorks(t *testing.T) {
assert := assert.New(t)
Log.Debug.SetOutput(os.Stderr)
whip := make(map[string]swaggering.DummyControl)
reg := sous.NewDummyRegistry()
client := sous.NewDummyRectificationClient()
dep := deployer{client,
func(url string) *singularity.Client {
cl, co := singularity.NewDummyClient(url)
co.FeedDTO(&dtos.SingularityRequestParentList{
&dtos.SingularityRequestParent{
RequestDeployState: &dtos.SingularityRequestDeployState{
ActiveDeploy: &dtos.SingularityDeployMarker{
DeployId: "testdep",
RequestId: "testreq",
},
},
Request: &dtos.SingularityRequest{
Id: "testreq",
RequestType: dtos.SingularityRequestRequestTypeSERVICE,
Owners: swaggering.StringList{"[email protected]"},
},
},
}, nil)
co.FeedDTO(&dtos.SingularityDeployHistory{
Deploy: &dtos.SingularityDeploy{
Id: "testdep",
ContainerInfo: &dtos.SingularityContainerInfo{
Type: dtos.SingularityContainerInfoSingularityContainerTypeDOCKER,
Docker: &dtos.SingularityDockerInfo{},
Volumes: dtos.SingularityVolumeList{
&dtos.SingularityVolume{
HostPath: "/onhost",
ContainerPath: "/indocker",
Mode: dtos.SingularityVolumeSingularityDockerVolumeModeRW,
},
},
},
Resources: &dtos.Resources{},
},
}, nil)
whip[url] = co
return cl
},
}
clusters := sous.Clusters{"test": {BaseURL: "http://test-singularity.org/"}}
res, err := dep.RunningDeployments(reg, clusters)
assert.NoError(err)
assert.NotNil(res)
}
示例15: TestInvokeInit
func TestInvokeInit(t *testing.T) {
assert := assert.New(t)
exe := justCommand(t, []string{`sous`, `init`})
init := exe.Cmd.(*SousInit)
assert.NotNil(init)
assert.False(init.Flags.IgnoreOTPLDeploy)
assert.False(init.Flags.IgnoreOTPLDeploy)
}