Skip to content

Commit 14ece0d

Browse files
nybidarigvisor-bot
authored andcommitted
Remove TESTONLY from the save restore netstack flag name.
PiperOrigin-RevId: 762056877
1 parent 19e9fc7 commit 14ece0d

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ docker-tests: load-basic $(RUNTIME_BIN)
365365
@$(call install_runtime,$(RUNTIME)-dcache,--fdlimit=2000 --dcache=100) # Used by TestDentryCacheLimit.
366366
@$(call install_runtime,$(RUNTIME)-host-uds,--host-uds=all) # Used by TestHostSocketConnect.
367367
@$(call install_runtime,$(RUNTIME)-overlay,--overlay2=all:self) # Used by TestOverlay*.
368-
@$(call install_runtime,$(RUNTIME)-TESTONLY-save-restore-netstack,--TESTONLY-save-restore-netstack=true) # Used by TestRestoreListenConnWithNetstackSR.
368+
@$(call install_runtime,$(RUNTIME)-save-restore-netstack,--save-restore-netstack=true) # Used by TestRestoreListenConnWithNetstackSR.
369369
@$(call test_runtime,$(RUNTIME),$(INTEGRATION_TARGETS) --test_env=TEST_SAVE_RESTORE_NETSTACK=true //test/e2e:integration_runtime_test //test/e2e:runtime_in_docker_test)
370370
.PHONY: docker-tests
371371

pkg/test/testutil/testutil.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var (
5858
isRunningWithOverlay = flag.Bool("test-overlay", BoolFromEnv("TEST_OVERLAY", false), "whether test is running with --overlay2")
5959
isRunningWithNetRaw = flag.Bool("test-net-raw", BoolFromEnv("TEST_NET_RAW", false), "whether test is running with raw socket support")
6060
isRunningWithHostNet = flag.Bool("test-hostnet", BoolFromEnv("TEST_HOSTNET", false), "whether test is running with hostnet")
61-
isRunningWithSaveRestoreNetstack = flag.Bool("test-save-restore-netstack", BoolFromEnv("TEST_SAVE_RESTORE_NETSTACK", false), "whether test is running with --TESTONLY-save-restore-netstack")
61+
isRunningWithSaveRestoreNetstack = flag.Bool("test-save-restore-netstack", BoolFromEnv("TEST_SAVE_RESTORE_NETSTACK", false), "whether test is running with --save-restore-netstack")
6262
// TestEnvSupportsNetAdmin indicates whether a test sandbox can perform
6363
// all net admin tasks. Note that some test environments cannot perform
6464
// some tasks despite the presence of CAP_NET_ADMIN.

runsc/boot/loader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ func New(args Args) (*Loader, error) {
569569
}
570570

571571
// S/R is not supported for hostinet.
572-
if l.root.conf.Network != config.NetworkHost && args.Conf.TestOnlySaveRestoreNetstack {
572+
if l.root.conf.Network != config.NetworkHost && args.Conf.SaveRestoreNetstack {
573573
l.saveRestoreNet = true
574574
if err := netns.Stack().EnableSaveRestore(); err != nil {
575575
return nil, fmt.Errorf("enable s/r: %w", err)

runsc/config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,6 @@ type Config struct {
382382
// TestOnlyAutosaveResume indicates save resume for syscall tests.
383383
TestOnlyAutosaveResume bool `flag:"TESTONLY-autosave-resume"`
384384

385-
// TestOnlySaveRestoreNetstack indicates netstack should be saved and restored.
386-
TestOnlySaveRestoreNetstack bool `flag:"TESTONLY-save-restore-netstack"`
387-
388385
// RestoreSpecValidation indicates the level of spec validation to be
389386
// performed during restore.
390387
RestoreSpecValidation RestoreSpecValidationPolicy `flag:"restore-spec-validation"`
@@ -394,6 +391,9 @@ type Config struct {
394391

395392
// SystrapDisableSyscallPatching disables syscall patching in Systrap.
396393
SystrapDisableSyscallPatching bool `flag:"systrap-disable-syscall-patching"`
394+
395+
// SaveRestoreNetstack indicates whether netstack should be saved and restored.
396+
SaveRestoreNetstack bool `flag:"save-restore-netstack"`
397397
}
398398

399399
func (c *Config) validate() error {

runsc/config/flags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ func RegisterFlags(flagSet *flag.FlagSet) {
149149
flagSet.Bool("reproduce-nat", false, "Scrape the host netns NAT table and reproduce it in the sandbox.")
150150
flagSet.Bool(flagReproduceNFTables, false, "Attempt to scrape and reproduce nftable rules inside the sandbox. Overrides reproduce-nat when true.")
151151
flagSet.Bool(flagNetDisconnectOK, true, "Indicates whether open network connections and open unix domain sockets should be disconnected upon save.")
152+
flagSet.Bool("save-restore-netstack", false, "Indicates whether netstack save/restore is enabled.")
152153

153154
// Flags that control sandbox runtime behavior: accelerator related.
154155
flagSet.Bool("nvproxy", false, "EXPERIMENTAL: enable support for Nvidia GPUs")
@@ -164,7 +165,6 @@ func RegisterFlags(flagSet *flag.FlagSet) {
164165
flagSet.Bool("TESTONLY-afs-syscall-panic", false, "TEST ONLY; do not ever use! Used for tests exercising gVisor panic reporting.")
165166
flagSet.String("TESTONLY-autosave-image-path", "", "TEST ONLY; enable auto save for syscall tests and set path for state file.")
166167
flagSet.Bool("TESTONLY-autosave-resume", false, "TEST ONLY; enable auto save and resume for syscall tests and set path for state file.")
167-
flagSet.Bool("TESTONLY-save-restore-netstack", false, "TEST ONLY; enable save/restore for netstack.")
168168
}
169169

170170
// overrideAllowlist lists all flags that can be changed using OCI

test/e2e/integration_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,7 @@ func testCheckpointRestoreListeningConnection(ctx context.Context, t *testing.T,
13111311
}
13121312
}
13131313

1314-
// Test to check restore of a TCP listening connection.
1314+
// Test to check restore of a TCP listening connection without netstack S/R.
13151315
func TestRestoreListenConn(t *testing.T) {
13161316
if !testutil.IsCheckpointSupported() {
13171317
t.Skip("Checkpoint is not supported.")
@@ -1334,7 +1334,7 @@ func TestRestoreListenConnWithNetstackSR(t *testing.T) {
13341334
dockerutil.EnsureDockerExperimentalEnabled()
13351335

13361336
ctx := context.Background()
1337-
d := dockerutil.MakeContainerWithRuntime(ctx, t, "-TESTONLY-save-restore-netstack")
1337+
d := dockerutil.MakeContainerWithRuntime(ctx, t, "-save-restore-netstack")
13381338
testCheckpointRestoreListeningConnection(ctx, t, d, "./tcp_server" /* fName */, 1 /* numConn */)
13391339
}
13401340

@@ -1349,6 +1349,6 @@ func TestRestoreMultipleListenConnWithNetstackSR(t *testing.T) {
13491349
dockerutil.EnsureDockerExperimentalEnabled()
13501350

13511351
ctx := context.Background()
1352-
d := dockerutil.MakeContainerWithRuntime(ctx, t, "-TESTONLY-save-restore-netstack")
1352+
d := dockerutil.MakeContainerWithRuntime(ctx, t, "-save-restore-netstack")
13531353
testCheckpointRestoreListeningConnection(ctx, t, d, "./tcp_stress_server" /* fName */, 100 /* numConn */)
13541354
}

test/runner/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ func runRunsc(tc *gtest.TestCase, spec *specs.Spec) error {
405405
// Create the state file.
406406
if *save || *saveResume {
407407
if *netstackSR {
408-
args = append(args, "--TESTONLY-save-restore-netstack=true")
408+
args = append(args, "--save-restore-netstack=true")
409409
}
410410
saveArgs = args
411411
args, dirs, err = prepareSave(args, undeclaredOutputsDir, dirs, 0)

0 commit comments

Comments
 (0)