Skip to content

Commit

Permalink
directory in use changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-gray101 committed Feb 28, 2024
1 parent 7c183a5 commit e721b2b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions core/http/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ var _ = Describe("API test", func() {
var c context.Context
var cancel context.CancelFunc
var tmpdir string
var modelDir string

commonOpts := []config.AppOption{
config.WithDebug(true),
Expand All @@ -144,7 +145,7 @@ var _ = Describe("API test", func() {
var err error
tmpdir, err = os.MkdirTemp("", "")
Expect(err).ToNot(HaveOccurred())
modelDir := filepath.Join(tmpdir, "models")
modelDir = filepath.Join(tmpdir, "models")
err = os.Mkdir(modelDir, 0755)
Expect(err).ToNot(HaveOccurred())

Expand Down Expand Up @@ -232,10 +233,10 @@ var _ = Describe("API test", func() {
}, "360s", "10s").Should(Equal(true))
Expect(resp["message"]).ToNot(ContainSubstring("error"))

dat, err := os.ReadFile(filepath.Join(tmpdir, "bert2.yaml"))
dat, err := os.ReadFile(filepath.Join(modelDir, "bert2.yaml"))
Expect(err).ToNot(HaveOccurred())

_, err = os.ReadFile(filepath.Join(tmpdir, "foo.yaml"))
_, err = os.ReadFile(filepath.Join(modelDir, "foo.yaml"))
Expect(err).ToNot(HaveOccurred())

content := map[string]interface{}{}
Expand Down Expand Up @@ -274,7 +275,7 @@ var _ = Describe("API test", func() {
return response["processed"].(bool)
}, "360s", "10s").Should(Equal(true))

dat, err := os.ReadFile(filepath.Join(tmpdir, "bert.yaml"))
dat, err := os.ReadFile(filepath.Join(modelDir, "bert.yaml"))
Expect(err).ToNot(HaveOccurred())

content := map[string]interface{}{}
Expand All @@ -298,7 +299,7 @@ var _ = Describe("API test", func() {
return response["processed"].(bool)
}, "360s", "10s").Should(Equal(true))

dat, err := os.ReadFile(filepath.Join(tmpdir, "bert.yaml"))
dat, err := os.ReadFile(filepath.Join(modelDir, "bert.yaml"))
Expect(err).ToNot(HaveOccurred())

content := map[string]interface{}{}
Expand Down Expand Up @@ -530,7 +531,8 @@ var _ = Describe("API test", func() {
AfterEach(func() {
cancel()
app.Shutdown()
os.RemoveAll(tmpdir)
err := os.RemoveAll(tmpdir)
Expect(err).ToNot(HaveOccurred())
})
It("installs and is capable to run tts", Label("tts"), func() {
if runtime.GOOS != "linux" {
Expand Down

0 comments on commit e721b2b

Please sign in to comment.