parent
999f6c6a24
commit
1c48601792
|
@ -16,10 +16,14 @@ var _ chronograf.OrganizationsStore = &OrganizationsStore{}
|
|||
// OrganizationsBucket is the bucket where organizations are stored.
|
||||
var OrganizationsBucket = []byte("OrganizationsV1")
|
||||
|
||||
// DefaultOrganizationID is the ID of the default organization.
|
||||
const DefaultOrganizationID uint64 = 0
|
||||
const DefaultOrganizationName string = "Default"
|
||||
const DefaultOrganizationRole string = "member"
|
||||
const (
|
||||
// DefaultOrganizationID is the ID of the default organization.
|
||||
DefaultOrganizationID uint64 = 0
|
||||
// DefaultOrganizationName is the Name of the default organization
|
||||
DefaultOrganizationName string = "Default"
|
||||
// DefaultOrganizationRole is the DefaultRole for the Default organization
|
||||
DefaultOrganizationRole string = "member"
|
||||
)
|
||||
|
||||
// OrganizationsStore uses bolt to store and retrieve Organizations
|
||||
type OrganizationsStore struct {
|
||||
|
|
|
@ -393,6 +393,44 @@ func TestOrganizationStore_Delete(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestOrganizationStore_DeleteDefaultOrg(t *testing.T) {
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "Delete the default organization",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
client, err := NewTestClient()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := client.Open(context.TODO()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer client.Close()
|
||||
s := client.OrganizationsStore
|
||||
|
||||
defaultOrg, err := s.DefaultOrganization(tt.args.ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := s.Delete(tt.args.ctx, defaultOrg); (err != nil) != tt.wantErr {
|
||||
t.Errorf("%q. OrganizationsStore.Delete() error = %v, wantErr %v", tt.name, err, tt.wantErr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestOrganizationsStore_Add(t *testing.T) {
|
||||
type fields struct {
|
||||
orgs []chronograf.Organization
|
||||
|
|
Loading…
Reference in New Issue