mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-14 22:37:03 +00:00
PMM-11406 Change test to verify if we got some GetHostInfoResult.
This commit is contained in:
@@ -50,23 +50,17 @@ func TestGetHostInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetHostInfoResult(t *testing.T) {
|
||||
assert := require.New(t)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
client, err := tu.TestClient(ctx, tu.MongoDBShard1PrimaryPort)
|
||||
assert.NoError(err, "cannot get a new MongoDB client")
|
||||
require.NoError(t, err, "cannot get a new MongoDB client")
|
||||
|
||||
host, err := getHostInfo(ctx, client)
|
||||
assert.NoError(err, "getHostInfo error")
|
||||
require.NoError(t, err, "getHostInfo error")
|
||||
|
||||
// With the current setup, we should get this information.
|
||||
assert.NotEmpty(host.ProcessName, "ProcessName should not be empty if serverStatus succeeds")
|
||||
assert.NotEmpty(host.Version, "Version should not be empty if serverStatus succeeds")
|
||||
assert.NotEmpty(host.ProcPath, "ProcPath should not be empty if getProcInfo succeeds")
|
||||
assert.NotEmpty(host.ProcUserName, "ProcUserName should not be empty if getProcInfo succeeds")
|
||||
assert.False(host.ProcCreateTime.IsZero(), "ProcCreateTime should not be zero if getProcInfo succeeds")
|
||||
notEmpty := host.ProcessName != "" || host.Version != "" || host.ProcPath != "" || host.ProcUserName != "" || !host.ProcCreateTime.IsZero()
|
||||
require.True(t, notEmpty, "At least one field in host should not be empty to ensure we got some data")
|
||||
}
|
||||
|
||||
func TestClusterWideInfo(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user