當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。