@@ -10,12 +10,12 @@ import (
1010 "github.com/stretchr/testify/require"
1111)
1212
13- // TestStandbyDisableEnable exercises POST /system/standby/{disable,enable}
14- // against the real built image. The unikraft control file does not exist
15- // inside the docker test container, so the underlying scale-to-zero write
16- // is a no-op — this test validates HTTP wiring, idempotency, and that the
17- // scale-to-zero middleware coexists with the pin handlers.
18- func TestStandbyDisableEnable (t * testing.T ) {
13+ // TestScaleToZeroPinUnpin exercises POST /scaletozero/{pin,unpin} against the
14+ // real built image. The unikraft control file does not exist inside the docker
15+ // test container, so the underlying scale-to-zero write is a no-op — this test
16+ // validates HTTP wiring, idempotency, and that the scale-to-zero middleware
17+ // coexists with the pin handlers.
18+ func TestScaleToZeroPinUnpin (t * testing.T ) {
1919 t .Parallel ()
2020
2121 if _ , err := exec .LookPath ("docker" ); err != nil {
@@ -34,13 +34,13 @@ func TestStandbyDisableEnable(t *testing.T) {
3434 client , err := c .APIClient ()
3535 require .NoError (t , err , "failed to create API client" )
3636
37- // Idempotent disable .
38- r1 , err := client .DisableStandbyWithResponse (ctx )
39- require .NoError (t , err , "DisableStandby request failed" )
37+ // Idempotent pin .
38+ r1 , err := client .PinScaleToZeroWithResponse (ctx )
39+ require .NoError (t , err , "PinScaleToZero request failed" )
4040 require .Equal (t , http .StatusNoContent , r1 .StatusCode (), "unexpected status: %s body=%s" , r1 .Status (), string (r1 .Body ))
4141
42- r2 , err := client .DisableStandbyWithResponse (ctx )
43- require .NoError (t , err , "second DisableStandby request failed" )
42+ r2 , err := client .PinScaleToZeroWithResponse (ctx )
43+ require .NoError (t , err , "second PinScaleToZero request failed" )
4444 require .Equal (t , http .StatusNoContent , r2 .StatusCode (), "unexpected status: %s body=%s" , r2 .Status (), string (r2 .Body ))
4545
4646 // Normal request must still flow while pinned (scaletozero middleware
@@ -49,12 +49,12 @@ func TestStandbyDisableEnable(t *testing.T) {
4949 require .NoError (t , err , "ReadClipboard request failed while pinned" )
5050 require .Equal (t , http .StatusOK , readResp .StatusCode (), "unexpected read status while pinned: %s body=%s" , readResp .Status (), string (readResp .Body ))
5151
52- // Idempotent enable .
53- r3 , err := client .EnableStandbyWithResponse (ctx )
54- require .NoError (t , err , "EnableStandby request failed" )
52+ // Idempotent unpin .
53+ r3 , err := client .UnpinScaleToZeroWithResponse (ctx )
54+ require .NoError (t , err , "UnpinScaleToZero request failed" )
5555 require .Equal (t , http .StatusNoContent , r3 .StatusCode (), "unexpected status: %s body=%s" , r3 .Status (), string (r3 .Body ))
5656
57- r4 , err := client .EnableStandbyWithResponse (ctx )
58- require .NoError (t , err , "second EnableStandby request failed" )
57+ r4 , err := client .UnpinScaleToZeroWithResponse (ctx )
58+ require .NoError (t , err , "second UnpinScaleToZero request failed" )
5959 require .Equal (t , http .StatusNoContent , r4 .StatusCode (), "unexpected status: %s body=%s" , r4 .Status (), string (r4 .Body ))
6060}
0 commit comments