mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-06 19:07:50 +00:00
fixed tests further, hopefully
This commit is contained in:
parent
64128b0baf
commit
df7fa12b5f
2 changed files with 26 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ const (
|
|||
ErrDatabaseIDDoesNotExist errors.Code = "DatabaseIDDoesNotExist"
|
||||
ErrDatabaseNameDoesNotExist errors.Code = "DatabaseNameDoesNotExist"
|
||||
ErrDatabaseNameExists errors.Code = "DatabaseNameExists"
|
||||
ErrDatabaseNameInvalid errors.Code = "DatabaseNameInvalid"
|
||||
|
||||
ErrTableIDExists errors.Code = "TableIDExists"
|
||||
ErrTableKeyExists errors.Code = "TableKeyExists"
|
||||
|
|
@ -39,6 +40,13 @@ func NewErrOrganizationIDDoesNotExist(orgID OrganizationID) error {
|
|||
)
|
||||
}
|
||||
|
||||
func NewErrDatabaseNameInvalid(qdb QualifiedDatabase) error {
|
||||
return errors.New(
|
||||
ErrDatabaseNameInvalid,
|
||||
fmt.Sprintf("invalid database name %s, must match [a-z][a-z0-9Θ_-]* and contain at most 300 characters", string(qdb.Name)),
|
||||
)
|
||||
}
|
||||
|
||||
func NewErrDatabaseIDExists(qdbid QualifiedDatabaseID) error {
|
||||
return errors.New(
|
||||
ErrDatabaseIDExists,
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ func TestDAXIntegration(t *testing.T) {
|
|||
dbID := dax.DatabaseID("db1")
|
||||
qdbid := dax.NewQualifiedDatabaseID(orgID, dbID)
|
||||
dbname := dax.DatabaseName("dbname1")
|
||||
dbname2 := dax.DatabaseName("-dbname2")
|
||||
qdb := &dax.QualifiedDatabase{
|
||||
OrganizationID: qdbid.OrganizationID,
|
||||
Database: dax.Database{
|
||||
|
|
@ -50,6 +51,18 @@ func TestDAXIntegration(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
qdb2 := &dax.QualifiedDatabase{
|
||||
OrganizationID: qdbid.OrganizationID,
|
||||
Database: dax.Database{
|
||||
ID: qdbid.DatabaseID,
|
||||
Name: dbname2,
|
||||
Options: dax.DatabaseOptions{
|
||||
WorkersMin: 1,
|
||||
WorkersMax: 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
t.Run("ServiceStart", func(t *testing.T) {
|
||||
t.Run("AllServicesByDefault", func(t *testing.T) {
|
||||
// Run ManagedCommand with no options (just defaulting to one
|
||||
|
|
@ -803,6 +816,11 @@ func TestDAXIntegration(t *testing.T) {
|
|||
assertCode(t, err, schemar.ErrCodeDatabaseNameInvalid)
|
||||
})
|
||||
|
||||
t.Run("CreateDatabase with Invalid Name", func(t *testing.T) {
|
||||
err := client.CreateDatabase(ctx, qdb2)
|
||||
assertCode(t, err, dax.ErrDatabaseNameInvalid)
|
||||
})
|
||||
|
||||
t.Run("DropDatabase", func(t *testing.T) {
|
||||
err := client.DropDatabase(ctx, qdbid)
|
||||
assertCode(t, err, dax.ErrDatabaseIDDoesNotExist)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue