test: TestSecret_Equal

This commit is contained in:
Markus Pesch 2023-07-24 09:11:39 +02:00
parent 0d91cdcc6f
commit 5ee7bb462c
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982

View File

@ -157,6 +157,47 @@ func TestNetworkIPAM_Config(t *testing.T) {
}
}
func TestSecret_Config(t *testing.T) {
require := require.New(t)
testCases := []struct {
equalableA dockerCompose.Equalable
equalableB dockerCompose.Equalable
expectedResult bool
}{
{
equalableA: &dockerCompose.Secret{},
equalableB: &dockerCompose.Service{},
expectedResult: false,
},
{
equalableA: &dockerCompose.Secret{},
equalableB: nil,
expectedResult: false,
},
{
equalableA: &dockerCompose.Secret{
File: "/var/run/docker/app/secret",
},
equalableB: &dockerCompose.Secret{},
expectedResult: false,
},
{
equalableA: &dockerCompose.Secret{
File: "/var/run/docker/app/secret",
},
equalableB: &dockerCompose.Secret{
File: "/var/run/docker/app/secret",
},
expectedResult: true,
},
}
for i, testCase := range testCases {
require.Equal(testCase.expectedResult, testCase.equalableA.Equal(testCase.equalableB), "Failed test case %v", i)
}
}
func TestServiceDeployResourcesLimits_Equal(t *testing.T) {
require := require.New(t)