grim/convey
Clone
Summary
Browse
Changes
Graph
Update to Go 1.21 and use some new helpers
5 months ago, Elliott Sales de Andrade
adb6eb2a7d21
Update to Go 1.21 and use some new helpers
`strings.Cut` was added in 1.18, and `maps`/`slices` in 1.21.
Testing Done:
Ran `go test ./...`
Reviewed at https://reviews.imfreedom.org/r/2870/
package
docker
import
(
"testing"
"github.com/stretchr/testify/assert"
"keep.imfreedom.org/grim/convey/podman"
"keep.imfreedom.org/grim/convey/yaml"
)
func
TestPushImage
(
t
*
testing
.
T
)
{
p
:=
&
Push
{
Image
:
"foo"
,
}
assert
.
NoError
(
t
,
p
.
Valid
())
}
func
TestPushImages
(
t
*
testing
.
T
)
{
p
:=
&
Push
{
Images
:
[]
string
{
"foo"
,
"bar"
},
}
assert
.
NoError
(
t
,
p
.
Valid
())
}
func
TestPushImagesMerged
(
t
*
testing
.
T
)
{
p
:=
&
Push
{
Image
:
"foo"
,
Images
:
[]
string
{
"bar"
},
}
assert
.
NoError
(
t
,
p
.
Valid
())
assert
.
Equal
(
t
,
p
.
Images
,
yaml
.
StringOrSlice
{
"foo"
,
"bar"
})
}
func
TestPushImageRequired
(
t
*
testing
.
T
)
{
p
:=
&
Push
{}
assert
.
ErrorIs
(
t
,
p
.
Valid
(),
podman
.
ErrNoTags
)
}