-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(labels): adds node type label to resources * default type is FullNode * allowed values are FullNode|Sentry * fix(labels): test names * fix: uses constant for node type * refactor: adds HasTypeLabel assertion * style: goimports
- Loading branch information
1 parent
48f30b6
commit dce3b8b
Showing
7 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package test | ||
|
||
import ( | ||
"testing" | ||
|
||
cosmosv1 "github.com/strangelove-ventures/cosmos-operator/api/v1" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func HasTypeLabel(t *testing.T, builder func(crd cosmosv1.CosmosFullNode) []map[string]string) { | ||
t.Run("sets labels for", func(t *testing.T) { | ||
var crd cosmosv1.CosmosFullNode | ||
crd.Spec.Replicas = 3 | ||
|
||
t.Run("type", func(t *testing.T) { | ||
t.Run("given unspecified type sets type to FullNode", func(t *testing.T) { | ||
resources := builder(crd) | ||
|
||
for _, resource := range resources { | ||
require.Equal(t, "FullNode", resource["cosmos.strange.love/type"]) | ||
} | ||
}) | ||
|
||
t.Run("given Sentry type", func(t *testing.T) { | ||
crd.Spec.Type = "Sentry" | ||
resources := builder(crd) | ||
|
||
for _, resource := range resources { | ||
require.Equal(t, "Sentry", resource["cosmos.strange.love/type"]) | ||
} | ||
}) | ||
|
||
t.Run("given FullNode type", func(t *testing.T) { | ||
crd.Spec.Type = "FullNode" | ||
resources := builder(crd) | ||
|
||
for _, resource := range resources { | ||
require.Equal(t, "FullNode", resource["cosmos.strange.love/type"]) | ||
} | ||
}) | ||
}) | ||
}) | ||
} |