Skip to content

Commit 8089e24

Browse files
author
Rahul Sharma
committed
add check for env var as well
1 parent dc54fe4 commit 8089e24

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cloud/linode/node_controller_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66
"net"
77
"net/http"
8+
"os"
89
"testing"
910
"time"
1011

@@ -141,7 +142,14 @@ func TestNodeController_handleNode(t *testing.T) {
141142
assert.NoError(t, err, "expected no error during node creation")
142143

143144
instCache := newInstances(client)
145+
146+
err = os.Setenv("LINODE_METADATA_TTL", "30")
147+
if err != nil {
148+
t.Fatalf("failed to set environment variable: %v", err)
149+
}
150+
144151
nodeCtrl := newNodeController(kubeClient, client, nil, instCache)
152+
assert.Equal(t, 30*time.Second, nodeCtrl.ttl, "expected ttl to be 30 seconds")
145153

146154
// Test: Successful metadata update
147155
publicIP := net.ParseIP("172.234.31.123")

0 commit comments

Comments
 (0)