Minor code maintenance for ModelStore (#492)
This commit is contained in:
parent
97113aa80b
commit
133314ebaa
@ -70,7 +70,7 @@ func tagsForModelWithID(
|
|||||||
tags map[string]string,
|
tags map[string]string,
|
||||||
) (map[string]string, error) {
|
) (map[string]string, error) {
|
||||||
if !s.Valid() {
|
if !s.Valid() {
|
||||||
return nil, errors.New("unrecognized model schema")
|
return nil, errors.WithStack(errUnrecognizedSchema)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(id) == 0 {
|
if len(id) == 0 {
|
||||||
@ -182,7 +182,7 @@ func (ms *ModelStore) GetIDsForType(
|
|||||||
tags map[string]string,
|
tags map[string]string,
|
||||||
) ([]*model.BaseModel, error) {
|
) ([]*model.BaseModel, error) {
|
||||||
if !s.Valid() {
|
if !s.Valid() {
|
||||||
return nil, errors.New("unrecognized model schema")
|
return nil, errors.WithStack(errUnrecognizedSchema)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := tags[stableIDKey]; ok {
|
if _, ok := tags[stableIDKey]; ok {
|
||||||
@ -222,7 +222,7 @@ func (ms *ModelStore) getModelStoreID(
|
|||||||
id model.StableID,
|
id model.StableID,
|
||||||
) (manifest.ID, error) {
|
) (manifest.ID, error) {
|
||||||
if !s.Valid() {
|
if !s.Valid() {
|
||||||
return "", errors.New("unrecognized model schema")
|
return "", errors.WithStack(errUnrecognizedSchema)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(id) == 0 {
|
if len(id) == 0 {
|
||||||
|
|||||||
@ -144,8 +144,7 @@ func (suite *ModelStoreIntegrationSuite) TestBadModelTypeErrors() {
|
|||||||
require.NoError(t, suite.m.Put(suite.ctx, model.BackupOpSchema, foo))
|
require.NoError(t, suite.m.Put(suite.ctx, model.BackupOpSchema, foo))
|
||||||
|
|
||||||
_, err := suite.m.GetIDsForType(suite.ctx, model.UnknownSchema, nil)
|
_, err := suite.m.GetIDsForType(suite.ctx, model.UnknownSchema, nil)
|
||||||
require.Error(t, err)
|
assert.ErrorIs(t, err, errUnrecognizedSchema)
|
||||||
assert.Contains(t, err.Error(), "schema")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *ModelStoreIntegrationSuite) TestBadTypeErrors() {
|
func (suite *ModelStoreIntegrationSuite) TestBadTypeErrors() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user