summaryrefslogtreecommitdiffhomepage
path: root/runsc/boot/loader_test.go
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2018-05-17 11:54:36 -0700
committerShentubot <shentubot@google.com>2018-05-17 11:55:28 -0700
commit31386185fe7c2079ee412a411e536a5bf9e9eb25 (patch)
treeb74f2fa66e0b95b705b27f2e335910091961bcd6 /runsc/boot/loader_test.go
parent8e1deb2ab8fb67da9a1f6521e31c5635ac587e71 (diff)
Push signal-delivery and wait into the sandbox.
This is another step towards multi-container support. Previously, we delivered signals directly to the sandbox process (which then forwarded the signal to PID 1 inside the sandbox). Similarly, we waited on a container by waiting on the sandbox process itself. This approach will not work when there are multiple containers inside the sandbox, and we need to signal/wait on individual containers. This CL adds two new messages, ContainerSignal and ContainerWait. These messages include the id of the container to signal/wait. The controller inside the sandbox receives these messages and signals/waits on the appropriate process inside the sandbox. The container id is plumbed into the sandbox, but it currently is not used. We still end up signaling/waiting on PID 1 in all cases. Once we actually have multiple containers inside the sandbox, we will need to keep some sort of map of container id -> pid (or possibly pid namespace), and signal/kill the appropriate process for the container. PiperOrigin-RevId: 197028366 Change-Id: I07b4d5dc91ecd2affc1447e6b4bdd6b0b7360895
Diffstat (limited to 'runsc/boot/loader_test.go')
-rw-r--r--runsc/boot/loader_test.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/runsc/boot/loader_test.go b/runsc/boot/loader_test.go
index c3d9887fa..d2e5fe74e 100644
--- a/runsc/boot/loader_test.go
+++ b/runsc/boot/loader_test.go
@@ -72,13 +72,13 @@ func TestRun(t *testing.T) {
var wg sync.WaitGroup
wg.Add(1)
go func() {
- resultChanErr = <-s.ctrl.app.startResultChan
+ resultChanErr = <-s.ctrl.manager.startResultChan
wg.Done()
}()
- // Run the application.
+ // Run the container..
if err := s.Run(); err != nil {
- t.Errorf("error running application: %v", err)
+ t.Errorf("error running container: %v", err)
}
// We should have not gotten an error on the startResultChan.
@@ -112,7 +112,7 @@ func TestStartSignal(t *testing.T) {
go func() {
s.WaitForStartSignal()
// Pretend that Run() executed and returned no error.
- s.ctrl.app.startResultChan <- nil
+ s.ctrl.manager.startResultChan <- nil
waitFinished <- struct{}{}
}()
@@ -126,9 +126,9 @@ func TestStartSignal(t *testing.T) {
// OK.
}
- // Trigger the control server Start method.
- if err := s.ctrl.app.Start(nil, nil); err != nil {
- t.Errorf("error calling Start: %v", err)
+ // Trigger the control server StartRoot method.
+ if err := s.ctrl.manager.StartRoot(nil, nil); err != nil {
+ t.Errorf("error calling StartRoot: %v", err)
}
// Now WaitForStartSignal should return (within a short amount of