11//
22// DISCLAIMER
33//
4- // Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
4+ // Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
55//
66// Licensed under the Apache License, Version 2.0 (the "License");
77// you may not use this file except in compliance with the License.
@@ -23,8 +23,10 @@ package v2alpha1
2323import (
2424 "encoding/json"
2525 "testing"
26+ "time"
2627
2728 "github.com/stretchr/testify/require"
29+ meta "k8s.io/apimachinery/pkg/apis/meta/v1"
2830)
2931
3032func Test_Action_Marshal (t * testing.T ) {
@@ -34,3 +36,54 @@ func Test_Action_Marshal(t *testing.T) {
3436 require .NoError (t , err )
3537 require .Equal (t , `{"id":"","type":"","creationTime":null}` , string (data ))
3638}
39+
40+ func Test_Action_Equal (t * testing.T ) {
41+ a := Action {
42+ ID : "9ktKQsBAqe5Ra8ZJ" ,
43+ SetID : "" ,
44+ Type : ActionTypeAddMember ,
45+ MemberID : "" ,
46+ Group : 2 ,
47+ CreationTime : meta.Time {
48+ Time : time .Date (2023 , time .August , 1 , 20 , 6 , 53 , 0 , time .UTC ),
49+ },
50+ StartTime : nil ,
51+ Reason : "" ,
52+ Image : "" ,
53+ Params : nil ,
54+ Locals : nil ,
55+ TaskID : "" ,
56+ Architecture : "" ,
57+ Progress : "" ,
58+ }
59+ b := Action {
60+ ID : "9ktKQsBAqe5Ra8ZJ" ,
61+ SetID : "" ,
62+ Type : ActionTypeAddMember ,
63+ MemberID : "" ,
64+ Group : 2 ,
65+ CreationTime : meta.Time {
66+ Time : time .Date (2023 , time .August , 1 , 20 , 6 , 53 , 0 , time .UTC ),
67+ },
68+ StartTime : nil ,
69+ Reason : "" ,
70+ Image : "" ,
71+ Params : nil ,
72+ Locals : nil ,
73+ TaskID : "" ,
74+ Architecture : "" ,
75+ Progress : "" ,
76+ }
77+
78+ require .True (t , a .Equal (a ))
79+ require .True (t , a .Equal (b ))
80+ require .True (t , b .Equal (a ))
81+ require .True (t , b .Equal (b ))
82+
83+ now := time .Now ()
84+ a .StartTime = & meta.Time {Time : now }
85+ require .True (t , a .Equal (a ))
86+ require .False (t , a .Equal (b ))
87+ require .False (t , b .Equal (a ))
88+ require .True (t , b .Equal (b ))
89+ }
0 commit comments