mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-02-19 07:50:43 +01:00
- Add comprehensive test coverage for agent report, flush buffer, and deps - Expand flow, HTTP, CPU, and swarm test coverage - Refactor registry access to use deps interface for better testability - Add container update and self-update test scenarios
36 lines
591 B
Go
36 lines
591 B
Go
package dockeragent
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/rs/zerolog"
|
|
)
|
|
|
|
func TestDefaultDeps(t *testing.T) {
|
|
swap(t, &goArch, "other")
|
|
_ = determineSelfUpdateArch()
|
|
|
|
if rc, err := openProcUptime(); err == nil {
|
|
_ = rc.Close()
|
|
}
|
|
|
|
if cli, err := newDockerClientFn(); err == nil {
|
|
_ = cli.Close()
|
|
}
|
|
|
|
agent := &Agent{logger: zerolog.Nop()}
|
|
_ = selfUpdateFunc(agent, context.Background())
|
|
}
|
|
|
|
func TestUnameMachineError(t *testing.T) {
|
|
prev := os.Getenv("PATH")
|
|
_ = os.Setenv("PATH", "")
|
|
t.Cleanup(func() {
|
|
_ = os.Setenv("PATH", prev)
|
|
})
|
|
|
|
_, _ = unameMachine()
|
|
}
|