File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 11package nodesubnet_test
22
33import (
4+ "context"
45 "net"
56 "testing"
67
78 "github.com/Azure/azure-container-networking/cns"
89 "github.com/Azure/azure-container-networking/cns/cnireconciler"
10+ "github.com/Azure/azure-container-networking/cns/logger"
911 "github.com/Azure/azure-container-networking/cns/nodesubnet"
1012 "github.com/Azure/azure-container-networking/cns/restserver"
1113 "github.com/Azure/azure-container-networking/cns/types"
@@ -97,3 +99,16 @@ func TestNewCNSPodInfoProvider(t *testing.T) {
9799 })
98100 }
99101}
102+
103+ // testContext creates a context from the provided testing.T that will be
104+ // canceled if the test suite is terminated.
105+ func testContext (t * testing.T ) (context.Context , context.CancelFunc ) {
106+ if deadline , ok := t .Deadline (); ok {
107+ return context .WithDeadline (context .Background (), deadline )
108+ }
109+ return context .WithCancel (context .Background ())
110+ }
111+
112+ func init () {
113+ logger .InitLogger ("testlogs" , 0 , 0 , "./" )
114+ }
You can’t perform that action at this time.
0 commit comments