mirror of
https://github.com/gravitational/teleport.git
synced 2026-10-29 17:58:15 +08:00
Address review comments
This commit is contained in:
+3
-12
@@ -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
|
||||
|
||||
@@ -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
|
||||
//
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user