(t *testing.T)
| 72 | } |
| 73 | |
| 74 | func TestModelFileStore(t *testing.T) { |
| 75 | a := assert.New(t) |
| 76 | ws, dst := mockModelDir(a) |
| 77 | defer os.RemoveAll(ws) |
| 78 | defer os.RemoveAll(dst) |
| 79 | model := &Model{workDir: ws} |
| 80 | session := database.GetSessionFromTestingDB() |
| 81 | modelURI := fmt.Sprintf("file://%s/model", dst) |
| 82 | |
| 83 | err := model.Save(modelURI, session) |
| 84 | a.NoError(err) |
| 85 | a.True(file.Exists(path.Join(dst, "model.tar.gz"))) |
| 86 | |
| 87 | model, err = Load(modelURI, dst, nil) |
| 88 | a.NoError(err) |
| 89 | a.True(file.Exists(path.Join(dst, "model.txt"))) |
| 90 | a.True(file.Exists(path.Join(dst, modelMetaFileName))) |
| 91 | meta, err := ioutil.ReadFile(path.Join(dst, modelMetaFileName)) |
| 92 | a.NoError(err) |
| 93 | a.Equal(modelMeta, string(meta)) |
| 94 | a.Equal("tf.estimator.BoostedTreesClassifier", model.GetMetaAsString("estimator")) |
| 95 | } |
| 96 | |
| 97 | func TestModelDBStore(t *testing.T) { |
| 98 | a := assert.New(t) |
nothing calls this directly
no test coverage detected