Address review comments

This commit is contained in:
dmitri
2021-03-11 17:05:38 -08:00
committed by Russell Jones
parent 3ed2afae08
commit 83c2808851
3 changed files with 5 additions and 14 deletions
+3 -12
View File
@@ -26,6 +26,8 @@ import (
"github.com/gravitational/teleport/api/utils"
"github.com/gravitational/trace"
"github.com/gogo/protobuf/proto"
)
// Server represents a Node, Proxy or Auth server in a Teleport cluster
@@ -334,18 +336,7 @@ func (s *ServerV2) CheckAndSetDefaults() error {
// DeepCopy creates a clone of this server value
func (s *ServerV2) DeepCopy() Server {
newServer := *s
if s.Metadata.Expires != nil {
expires := *s.Metadata.Expires
newServer.Metadata.Expires = &expires
}
if len(s.Metadata.Labels) != 0 {
newServer.Metadata.Labels = make(map[string]string)
for k, v := range s.Metadata.Labels {
newServer.Metadata.Labels[k] = v
}
}
return &newServer
return proto.Clone(s).(*ServerV2)
}
// CommandLabel is a label that has a value as a result of the
+1 -1
View File
@@ -137,7 +137,7 @@ func (s *ServerSuite) TestGuessProxyHostAndVersion(c *check.C) {
c.Assert(err, check.IsNil)
}
func TestUnmarshalServerResourceKubernetes(t *testing.T) {
func TestUnmarshalServerKubernetes(t *testing.T) {
// Regression test for
// https://github.com/gravitational/teleport/issues/4862
//
+1 -1
View File
@@ -108,7 +108,7 @@ func (s *ServicesSuite) TestLabelKeyValidation(c *check.C) {
func TestServerDeepCopy(t *testing.T) {
t.Parallel()
// setup
now := time.Date(1984, time.April, 4, 0, 0, 0, 0, time.Local)
now := time.Date(1984, time.April, 4, 0, 0, 0, 0, time.UTC)
expires := now.Add(1 * time.Hour)
srv := &ServerV2{
Kind: KindNode,