示例#1
0
func newStubStage1Setup(t *testing.T, serverSetup *taas.ServerSetup) *stubStage1Setup {
	ctx := testutils.NewRktRunCtx()
	defer func() {
		if ctx != nil {
			ctx.Cleanup()
		}
	}()

	var server *taas.Server
	stubStage1 := testutils.GetValueFromEnvOrPanic("STUB_STAGE1")
	if serverSetup != nil {
		server = runServer(t, serverSetup)
		defer func() {
			if server != nil {
				server.Close()
			}
		}()
		fileSet := map[string]string{
			filepath.Base(stubStage1): stubStage1,
		}
		if err := server.UpdateFileSet(fileSet); err != nil {
			t.Fatalf("Failed to populate a file list in test aci server: %v", err)
		}
	}

	setup := &stubStage1Setup{
		t:       t,
		ctx:     ctx,
		server:  server,
		name:    "localhost/rkt-stub-stage1",
		version: "0.0.1",
		path:    stubStage1,
	}
	ctx = nil
	server = nil
	return setup
}
示例#2
0
func authCleanup(server *taas.Server, image string) {
	server.Close()
	_ = os.Remove(image)
}