当前位置: 首页>>代码示例>>Golang>>正文


Golang Attrs.Delete方法代码示例

本文整理汇总了Golang中github.com/juju/juju/testing.Attrs.Delete方法的典型用法代码示例。如果您正苦于以下问题:Golang Attrs.Delete方法的具体用法?Golang Attrs.Delete怎么用?Golang Attrs.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/juju/juju/testing.Attrs的用法示例。


在下文中一共展示了Attrs.Delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

		about:       "set-numa-control-policy off",
		useDefaults: config.UseDefaults,
		attrs: minimalConfigAttrs.Merge(testing.Attrs{
			"set-numa-control-policy": false,
		}),
	}, {
		about:       "Invalid agent version",
		useDefaults: config.UseDefaults,
		attrs: minimalConfigAttrs.Merge(testing.Attrs{
			"agent-version": "2",
		}),
		err: `invalid agent version in model configuration: "2"`,
	}, {
		about:       "Missing type",
		useDefaults: config.UseDefaults,
		attrs:       minimalConfigAttrs.Delete("type"),
		err:         "type: expected string, got nothing",
	}, {
		about:       "Empty type",
		useDefaults: config.UseDefaults,
		attrs: minimalConfigAttrs.Merge(testing.Attrs{
			"type": "",
		}),
		err: "empty type in model configuration",
	}, {
		about:       "Missing name",
		useDefaults: config.UseDefaults,
		attrs:       minimalConfigAttrs.Delete("name"),
		err:         "name: expected string, got nothing",
	}, {
		about:       "Bad name, no slash",
开发者ID:bac,项目名称:juju,代码行数:31,代码来源:config_test.go

示例2:

		attrs:       sampleConfig.Merge(testing.Attrs{"ca-cert-path": "arble"}),
		err:         `attribute "ca-cert-path" is not allowed in configuration`,
	}, {
		about:       "No defaults: with ca-private-key-path",
		useDefaults: config.NoDefaults,
		attrs:       sampleConfig.Merge(testing.Attrs{"ca-private-key-path": "arble"}),
		err:         `attribute "ca-private-key-path" is not allowed in configuration`,
	}, {
		about:       "No defaults: with authorized-keys-path",
		useDefaults: config.NoDefaults,
		attrs:       sampleConfig.Merge(testing.Attrs{"authorized-keys-path": "arble"}),
		err:         `attribute "authorized-keys-path" is not allowed in configuration`,
	}, {
		about:       "No defaults: missing authorized-keys",
		useDefaults: config.NoDefaults,
		attrs:       sampleConfig.Delete("authorized-keys"),
		err:         `authorized-keys missing from environment configuration`,
	}, {
		about:       "Config settings from juju 1.13.3 actual installation",
		useDefaults: config.NoDefaults,
		attrs: map[string]interface{}{
			"name":                      "sample",
			"development":               false,
			"admin-secret":              "",
			"ssl-hostname-verification": true,
			"authorized-keys":           "ssh-rsa mykeys [email protected]\n",
			"control-bucket":            "rog-some-control-bucket",
			"region":                    "us-east-1",
			"image-metadata-url":        "",
			"ca-private-key":            "",
			"default-series":            "precise",
开发者ID:klyachin,项目名称:juju,代码行数:31,代码来源:config_test.go

示例3:

	}, {
		summary: "changing region",
		config:  requiredConfig,
		change: testing.Attrs{
			"region": "otherregion",
		},
		err: `cannot change region from "configtest" to "otherregion"`,
	}, {
		summary: "invalid region",
		config: requiredConfig.Merge(testing.Attrs{
			"region": 666,
		}),
		err: `.*expected string, got int\(666\)`,
	}, {
		summary: "missing region in model",
		config:  requiredConfig.Delete("region"),
		err:     "missing region not valid",
	}, {
		summary: "invalid username",
		config: requiredConfig.Merge(testing.Attrs{
			"username": 666,
		}),
		err: `.*expected string, got int\(666\)`,
	}, {
		summary: "missing username in model",
		config:  requiredConfig.Delete("username"),
		err:     "missing username not valid",
	}, {
		summary: "invalid password",
		config: requiredConfig.Merge(testing.Attrs{
			"password": 666,
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:31,代码来源:config_test.go


注:本文中的github.com/juju/juju/testing.Attrs.Delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。