File tree Expand file tree Collapse file tree 4 files changed +77
-14
lines changed
Expand file tree Collapse file tree 4 files changed +77
-14
lines changed Original file line number Diff line number Diff line change @@ -241,10 +241,16 @@ func unwrapInt32(w *wrapperspb.Int32Value) *int32 {
241241}
242242
243243func mustTimestampToTime (ts * timestamppb.Timestamp ) * time.Time {
244+ if ts == nil {
245+ return nil
246+ }
244247 t := ts .AsTime ()
245248 return & t
246249}
247250
248251func mustTimeToTimestamp (t * time.Time ) * timestamppb.Timestamp {
252+ if t == nil {
253+ return nil
254+ }
249255 return timestamppb .New (* t )
250256}
Original file line number Diff line number Diff line change @@ -97,6 +97,30 @@ func TestTenantMapperRoundtrip(t *testing.T) {
9797 },
9898 },
9999 },
100+ {
101+ name : "nil times" ,
102+ inAndOut : & v1.Tenant {
103+ Meta : & v1.Meta {
104+ Id : "1" ,
105+ Kind : "tenant" ,
106+ Apiversion : "1" ,
107+ Version : 99 ,
108+ CreatedTime : nil ,
109+ UpdatedTime : nil ,
110+ },
111+ Name : "tnt" ,
112+ Description : "tnt is a test tenant" ,
113+ IAMConfig : & v1.IAMConfig {
114+ IssuerConfig : & v1.IssuerConfig {
115+ URL : "https://oidc.myissuer.com" ,
116+ ClientID : "47abcdef12" ,
117+ },
118+ IDMConfig : & v1.IDMConfig {
119+ IDMType : "ldap" ,
120+ },
121+ },
122+ },
123+ },
100124 }
101125 for _ , tt := range tests {
102126 tt := tt
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ require (
2323 github.com/spf13/cobra v1.1.3
2424 github.com/spf13/viper v1.7.1
2525 github.com/stretchr/testify v1.7.0
26- github.com/testcontainers/testcontainers-go v0.10 .0
26+ github.com/testcontainers/testcontainers-go v0.11 .0
2727 go.uber.org/zap v1.17.0
2828 golang.org/x/net v0.0.0-20210525063256-abc453219eb5 // indirect
2929 google.golang.org/grpc v1.38.0
You can’t perform that action at this time.
0 commit comments