github.com/schwarzm/garden-linux@v0.0.0-20150507151835-33bca2147c47/old/system_info/fake_system_info/provider.go (about)

     1  package fake_system_info
     2  
     3  type FakeProvider struct {
     4  	TotalMemoryResult uint64
     5  	TotalMemoryError  error
     6  
     7  	TotalDiskResult uint64
     8  	TotalDiskError  error
     9  }
    10  
    11  func NewFakeProvider() *FakeProvider {
    12  	return &FakeProvider{}
    13  }
    14  
    15  func (provider *FakeProvider) TotalMemory() (uint64, error) {
    16  	if provider.TotalMemoryError != nil {
    17  		return 0, provider.TotalMemoryError
    18  	}
    19  
    20  	return provider.TotalMemoryResult, nil
    21  }
    22  
    23  func (provider *FakeProvider) TotalDisk() (uint64, error) {
    24  	if provider.TotalDiskError != nil {
    25  		return 0, provider.TotalDiskError
    26  	}
    27  
    28  	return provider.TotalDiskResult, nil
    29  }