Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Ortel <jortel@redhat.com>
  • Loading branch information
jortel committed Oct 17, 2023
1 parent 5964541 commit 2d73abc
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
14 changes: 11 additions & 3 deletions test/api/application/bucket_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package application

import (
"io/ioutil"
"os"
"testing"

"github.com/konveyor/tackle2-hub/api"
"github.com/konveyor/tackle2-hub/binding"
"github.com/konveyor/tackle2-hub/test/assert"
)

Expand All @@ -16,7 +16,15 @@ func TestApplicationBucket(t *testing.T) {
assert.Must(t, Application.Create(&application))

// Get the bucket to check if it was created.
err := Client.BucketGet(binding.Path(api.BucketRoot).Inject(binding.Params{api.ID: application.Bucket.ID}), "/dev/null")
destDir, err := ioutil.TempDir("", "destDir")
if err != nil {
t.Errorf(err.Error())
}
defer func() {
_ = os.RemoveAll(destDir)
}()
bucket := RichClient.Application.Bucket(application.ID)
err = bucket.Get("", destDir)
if err != nil {
t.Errorf(err.Error())
}
Expand Down
1 change: 1 addition & 0 deletions test/api/bucket/sample/sample2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The second file.
30 changes: 30 additions & 0 deletions test/api/task/bucket_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package task

import (
"io/ioutil"
"os"
"testing"

"github.com/konveyor/tackle2-hub/test/assert"
)

func TestTaskBucket(t *testing.T) {
task := Windup
// Create the application.
assert.Must(t, Task.Create(&task))
// Get the bucket to check if it was created.
destDir, err := ioutil.TempDir("", "destDir")
if err != nil {
t.Errorf(err.Error())
}
defer func() {
_ = os.RemoveAll(destDir)
}()
bucket := RichClient.Task.Bucket(task.ID)
err = bucket.Get("", destDir)
if err != nil {
t.Errorf(err.Error())
}
// Clean the application.
assert.Must(t, Task.Delete(task.ID))
}

0 comments on commit 2d73abc

Please sign in to comment.