github.com/vicanso/pike@v1.0.1-0.20210630235453-9099e041f6ec/app/app_test.go (about)

     1  package app
     2  
     3  import (
     4  	"runtime"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestSetSetBuildInfo(t *testing.T) {
    11  	assert := assert.New(t)
    12  	id := "123"
    13  	SetBuildInfo("2021-02-27T01:41:32.416Z", id, "version", "")
    14  
    15  	assert.Equal(id, commitID)
    16  	assert.Equal("2021-02-27 01:41:32.416 +0000 UTC", buildedAt.UTC().String())
    17  }
    18  
    19  func TestUpdateCPUUsage(t *testing.T) {
    20  	assert := assert.New(t)
    21  
    22  	err := UpdateCPUUsage()
    23  	assert.Nil(err)
    24  }
    25  
    26  func TestGetInfo(t *testing.T) {
    27  	assert := assert.New(t)
    28  
    29  	info := GetInfo()
    30  	assert.Equal(runtime.GOOS, info.GOOS)
    31  }