From 5ee7bb462c99903e1f0ebae550c41d3d62576003 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Mon, 24 Jul 2023 09:11:39 +0200 Subject: [PATCH] test: TestSecret_Equal --- pki/domain/dockerCompose/config_test.go | 41 +++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/pki/domain/dockerCompose/config_test.go b/pki/domain/dockerCompose/config_test.go index 6d57e0d..bb19e86 100644 --- a/pki/domain/dockerCompose/config_test.go +++ b/pki/domain/dockerCompose/config_test.go @@ -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)