@@ -56,3 +56,57 @@ func TestWithCPUCount(t *testing.T) {
5656 }
5757 }
5858}
59+
60+ func TestWithWindowsIgnoreFlushesDuringBoot (t * testing.T ) {
61+ var (
62+ ctx = namespaces .WithNamespace (context .Background (), "testing" )
63+ c = containers.Container {ID : t .Name ()}
64+ o = WithWindowsIgnoreFlushesDuringBoot ()
65+ )
66+ // Test with all supported scenarios
67+ platforms := []string {"" , "windows/amd64" }
68+ for _ , p := range platforms {
69+ var spec * Spec
70+ var err error
71+ if p == "" {
72+ t .Log ("Testing GenerateSpec default platform" )
73+ spec , err = GenerateSpec (ctx , nil , & c , o )
74+ } else {
75+ t .Logf ("Testing GenerateSpecWithPlatform with platform: '%s'" , p )
76+ spec , err = GenerateSpecWithPlatform (ctx , nil , p , & c , o )
77+ }
78+ if err != nil {
79+ t .Fatalf ("failed to generate spec with: %v" , err )
80+ }
81+ if spec .Windows .IgnoreFlushesDuringBoot != true {
82+ t .Fatalf ("spec.Windows.IgnoreFlushesDuringBoot expected: true" )
83+ }
84+ }
85+ }
86+
87+ func TestWithWindowNetworksAllowUnqualifiedDNSQuery (t * testing.T ) {
88+ var (
89+ ctx = namespaces .WithNamespace (context .Background (), "testing" )
90+ c = containers.Container {ID : t .Name ()}
91+ o = WithWindowNetworksAllowUnqualifiedDNSQuery ()
92+ )
93+ // Test with all supported scenarios
94+ platforms := []string {"" , "windows/amd64" }
95+ for _ , p := range platforms {
96+ var spec * Spec
97+ var err error
98+ if p == "" {
99+ t .Log ("Testing GenerateSpec default platform" )
100+ spec , err = GenerateSpec (ctx , nil , & c , o )
101+ } else {
102+ t .Logf ("Testing GenerateSpecWithPlatform with platform: '%s'" , p )
103+ spec , err = GenerateSpecWithPlatform (ctx , nil , p , & c , o )
104+ }
105+ if err != nil {
106+ t .Fatalf ("failed to generate spec with: %v" , err )
107+ }
108+ if spec .Windows .Network .AllowUnqualifiedDNSQuery != true {
109+ t .Fatalf ("spec.Windows.Network.AllowUnqualifiedDNSQuery expected: true" )
110+ }
111+ }
112+ }
0 commit comments