Convert assert.Check(t, is.Error()) to assert.Error

git grep -l -P '^\s+assert\.Check\(t, is\.Error\(' | \
    xargs perl -pi -e 's/^(\s+assert\.)Check\(t, is\.Error\((.*)\)$/\1Error(t, \2/'

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin
2018-03-06 16:00:28 -05:00
parent f21276575f
commit e15b208e96
47 changed files with 83 additions and 88 deletions
+2 -2
View File
@@ -26,7 +26,7 @@ func TestConvertRestartPolicyFromNone(t *testing.T) {
func TestConvertRestartPolicyFromUnknown(t *testing.T) {
_, err := convertRestartPolicy("unknown", nil)
assert.Check(t, is.Error(err, "unknown restart policy: unknown"))
assert.Error(t, err, "unknown restart policy: unknown")
}
func TestConvertRestartPolicyFromAlways(t *testing.T) {
@@ -161,7 +161,7 @@ func TestConvertHealthcheckDisableWithTest(t *testing.T) {
Test: []string{"EXEC", "touch"},
}
_, err := convertHealthcheck(source)
assert.Check(t, is.Error(err, "test and disable can't be set at the same time"))
assert.Error(t, err, "test and disable can't be set at the same time")
}
func TestConvertEndpointSpec(t *testing.T) {
+10 -10
View File
@@ -32,7 +32,7 @@ func TestConvertVolumeToMountAnonymousBind(t *testing.T) {
},
}
_, err := convertVolumeToMount(config, volumes{}, NewNamespace("foo"))
assert.Check(t, is.Error(err, "invalid bind source, source cannot be empty"))
assert.Error(t, err, "invalid bind source, source cannot be empty")
}
func TestConvertVolumeToMountUnapprovedType(t *testing.T) {
@@ -41,7 +41,7 @@ func TestConvertVolumeToMountUnapprovedType(t *testing.T) {
Target: "/foo/bar",
}
_, err := convertVolumeToMount(config, volumes{}, NewNamespace("foo"))
assert.Check(t, is.Error(err, "volume type must be volume, bind, or tmpfs"))
assert.Error(t, err, "volume type must be volume, bind, or tmpfs")
}
func TestConvertVolumeToMountConflictingOptionsBindInVolume(t *testing.T) {
@@ -56,7 +56,7 @@ func TestConvertVolumeToMountConflictingOptionsBindInVolume(t *testing.T) {
},
}
_, err := convertVolumeToMount(config, volumes{}, namespace)
assert.Check(t, is.Error(err, "bind options are incompatible with type volume"))
assert.Error(t, err, "bind options are incompatible with type volume")
}
func TestConvertVolumeToMountConflictingOptionsTmpfsInVolume(t *testing.T) {
@@ -71,7 +71,7 @@ func TestConvertVolumeToMountConflictingOptionsTmpfsInVolume(t *testing.T) {
},
}
_, err := convertVolumeToMount(config, volumes{}, namespace)
assert.Check(t, is.Error(err, "tmpfs options are incompatible with type volume"))
assert.Error(t, err, "tmpfs options are incompatible with type volume")
}
func TestConvertVolumeToMountConflictingOptionsVolumeInBind(t *testing.T) {
@@ -86,7 +86,7 @@ func TestConvertVolumeToMountConflictingOptionsVolumeInBind(t *testing.T) {
},
}
_, err := convertVolumeToMount(config, volumes{}, namespace)
assert.Check(t, is.Error(err, "volume options are incompatible with type bind"))
assert.Error(t, err, "volume options are incompatible with type bind")
}
func TestConvertVolumeToMountConflictingOptionsTmpfsInBind(t *testing.T) {
@@ -101,7 +101,7 @@ func TestConvertVolumeToMountConflictingOptionsTmpfsInBind(t *testing.T) {
},
}
_, err := convertVolumeToMount(config, volumes{}, namespace)
assert.Check(t, is.Error(err, "tmpfs options are incompatible with type bind"))
assert.Error(t, err, "tmpfs options are incompatible with type bind")
}
func TestConvertVolumeToMountConflictingOptionsBindInTmpfs(t *testing.T) {
@@ -115,7 +115,7 @@ func TestConvertVolumeToMountConflictingOptionsBindInTmpfs(t *testing.T) {
},
}
_, err := convertVolumeToMount(config, volumes{}, namespace)
assert.Check(t, is.Error(err, "bind options are incompatible with type tmpfs"))
assert.Error(t, err, "bind options are incompatible with type tmpfs")
}
func TestConvertVolumeToMountConflictingOptionsVolumeInTmpfs(t *testing.T) {
@@ -129,7 +129,7 @@ func TestConvertVolumeToMountConflictingOptionsVolumeInTmpfs(t *testing.T) {
},
}
_, err := convertVolumeToMount(config, volumes{}, namespace)
assert.Check(t, is.Error(err, "volume options are incompatible with type tmpfs"))
assert.Error(t, err, "volume options are incompatible with type tmpfs")
}
func TestConvertVolumeToMountNamedVolume(t *testing.T) {
@@ -309,7 +309,7 @@ func TestConvertVolumeToMountVolumeDoesNotExist(t *testing.T) {
ReadOnly: true,
}
_, err := convertVolumeToMount(config, volumes{}, namespace)
assert.Check(t, is.Error(err, "undefined volume \"unknown\""))
assert.Error(t, err, "undefined volume \"unknown\"")
}
func TestConvertTmpfsToMountVolume(t *testing.T) {
@@ -341,5 +341,5 @@ func TestConvertTmpfsToMountVolumeWithSource(t *testing.T) {
}
_, err := convertVolumeToMount(config, volumes{}, NewNamespace("foo"))
assert.Check(t, is.Error(err, "invalid tmpfs source, source must be empty"))
assert.Error(t, err, "invalid tmpfs source, source must be empty")
}
@@ -58,7 +58,7 @@ func TestInvalidInterpolation(t *testing.T) {
},
}
_, err := Interpolate(services, Options{LookupValue: defaultMapping})
assert.Check(t, is.Error(err, `invalid interpolation format for servicea.image: "${". You may need to escape any $ with another $.`))
assert.Error(t, err, `invalid interpolation format for servicea.image: "${". You may need to escape any $ with another $.`)
}
func TestInterpolateWithDefaults(t *testing.T) {
+1 -1
View File
@@ -29,7 +29,7 @@ func TestParseVolumeAnonymousVolumeWindows(t *testing.T) {
func TestParseVolumeTooManyColons(t *testing.T) {
_, err := ParseVolume("/foo:/foo:ro:foo")
assert.Check(t, is.Error(err, "invalid spec: /foo:/foo:ro:foo: too many colons"))
assert.Error(t, err, "invalid spec: /foo:/foo:ro:foo: too many colons")
}
func TestParseVolumeShortVolumes(t *testing.T) {