Skip to content

Commit

Permalink
add test for cmd/jeager/internal
Browse files Browse the repository at this point in the history
Signed-off-by: Harshvir Potpose <hpotpose62@gmail.com>
  • Loading branch information
akagami-harsh committed Jan 3, 2024
1 parent 5c6348e commit 876bb57
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
2 changes: 0 additions & 2 deletions cmd/jaeger/internal/.nocover

This file was deleted.

22 changes: 22 additions & 0 deletions cmd/jaeger/internal/command_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package internal

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestCommand(t *testing.T) {
cmd := Command()

assert.NotNil(t, cmd, "Command() should return a non-nil *cobra.Command instance")

expectedShortDescription := "Jaeger backend v2"
assert.Equal(t, expectedShortDescription, cmd.Short, "Command short description should be '%s'", expectedShortDescription)

expectedLongDescription := "Jaeger backend v2"
assert.Equal(t, expectedLongDescription, cmd.Long, "Command long description should be '%s'", expectedLongDescription)

assert.NotNil(t, cmd.RunE, "Command should have RunE function set")

}
22 changes: 22 additions & 0 deletions cmd/jaeger/internal/components_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package internal

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestComponents(t *testing.T) {
factories, err := components()

assert.NoError(t, err)

Check failure on line 12 in cmd/jaeger/internal/components_test.go

View workflow job for this annotation

GitHub Actions / lint

require-error: for error assertions use require (testifylint)

assert.NotNil(t, factories.Extensions)
assert.NotNil(t, factories.Receivers)
assert.NotNil(t, factories.Exporters)
assert.NotNil(t, factories.Processors)
assert.NotNil(t, factories.Connectors)

_, jaegerReceiverFactoryExists := factories.Receivers["jaeger"]
assert.True(t, jaegerReceiverFactoryExists)
}

0 comments on commit 876bb57

Please sign in to comment.