cluster_test.go 706 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package cluster // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/aerospikereceiver/cluster"
  4. import (
  5. "testing"
  6. as "github.com/aerospike/aerospike-client-go/v6"
  7. "github.com/stretchr/testify/require"
  8. "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/aerospikereceiver/cluster/mocks"
  9. )
  10. func TestCluster_GetNodes(t *testing.T) {
  11. t.Parallel()
  12. asc := mocks.NewAsclient(t)
  13. nodes := []*as.Node{
  14. {},
  15. {},
  16. }
  17. asc.On("GetNodes").Return(nodes)
  18. testCluster := Cluster{
  19. conn: asc,
  20. }
  21. actualNodes := testCluster.GetNodes()
  22. require.Equal(t, len(actualNodes), len(nodes))
  23. }