github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/pkg/vcmock/container.go (about)

     1  // Copyright (c) 2017 Intel Corporation
     2  //
     3  // SPDX-License-Identifier: Apache-2.0
     4  //
     5  
     6  package vcmock
     7  
     8  import (
     9  	vc "github.com/kata-containers/runtime/virtcontainers"
    10  )
    11  
    12  // ID implements the VCContainer function of the same name.
    13  func (c *Container) ID() string {
    14  	return c.MockID
    15  }
    16  
    17  // Sandbox implements the VCContainer function of the same name.
    18  func (c *Container) Sandbox() vc.VCSandbox {
    19  	return c.MockSandbox
    20  }
    21  
    22  // Process implements the VCContainer function of the same name.
    23  func (c *Container) Process() vc.Process {
    24  	// always return a mockprocess with a non-zero Pid
    25  	if c.MockProcess.Pid == 0 {
    26  		c.MockProcess.Pid = 1000
    27  	}
    28  	return c.MockProcess
    29  }
    30  
    31  // GetToken implements the VCContainer function of the same name.
    32  func (c *Container) GetToken() string {
    33  	return c.MockToken
    34  }
    35  
    36  // GetPid implements the VCContainer function of the same name.
    37  func (c *Container) GetPid() int {
    38  	return c.MockPid
    39  }
    40  
    41  // GetAnnotations implements the VCContainer function of the same name.
    42  func (c *Container) GetAnnotations() map[string]string {
    43  	return c.MockAnnotations
    44  }