-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add node roles to node list output vec-433 (#24)
* build(deps): update go client to support node roles * feat: vec-433 add node roles to node ls output * ci: test node roles with mixed role cluster
- Loading branch information
1 parent
8b227bb
commit 79fd24a
Showing
15 changed files
with
173 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package writers | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
|
||
"github.com/aerospike/avs-client-go/protos" | ||
) | ||
|
||
func Test_formatRole(t *testing.T) { | ||
type args struct { | ||
role protos.NodeRole | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want string | ||
}{ | ||
{ | ||
name: "TestRolePrimary", | ||
args: args{role: protos.NodeRole_INDEX_QUERY}, | ||
want: "INDEX_QUERY", | ||
}, | ||
{ | ||
name: "TestRoleSecondary", | ||
args: args{role: protos.NodeRole_INDEX_UPDATE}, | ||
want: "INDEX_UPDATE", | ||
}, | ||
{ | ||
name: "TestRoleUnknown", | ||
args: args{role: protos.NodeRole_KV_READ}, | ||
want: "KV_READ", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := formatRole(tt.args.role); got != tt.want { | ||
t.Errorf("formatRole() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
func Test_formatRoles(t *testing.T) { | ||
type args struct { | ||
roles []protos.NodeRole | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want []string | ||
}{ | ||
{ | ||
name: "TestMultipleRoles", | ||
args: args{ | ||
roles: []protos.NodeRole{ | ||
protos.NodeRole_INDEX_QUERY, | ||
protos.NodeRole_INDEX_UPDATE, | ||
protos.NodeRole_KV_READ, | ||
}, | ||
}, | ||
want: []string{"INDEX_QUERY", "INDEX_UPDATE", "KV_READ"}, | ||
}, | ||
{ | ||
name: "TestSingleRole", | ||
args: args{roles: []protos.NodeRole{protos.NodeRole_INDEX_QUERY}}, | ||
want: []string{"INDEX_QUERY"}, | ||
}, | ||
{ | ||
name: "TestNoRoles", | ||
args: args{roles: []protos.NodeRole{}}, | ||
want: []string{}, | ||
}, | ||
{ | ||
name: "TestNilRoles", | ||
args: args{roles: nil}, | ||
want: []string{}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := formatRoles(tt.args.roles); !reflect.DeepEqual(got, tt.want) { | ||
t.Errorf("formatRoles() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
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
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