-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(batch): Implement InsertBatch (#7)
- Loading branch information
1 parent
7b8a7fc
commit 164cc3e
Showing
4 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package livy_test | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/google/uuid" | ||
"github.com/k0kubun/pp" | ||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/3-shake/livy-go" | ||
) | ||
|
||
func TestBatch_List(t *testing.T) { | ||
res, err := service.Batches.List().Do() | ||
pp.Println(res, err) | ||
|
||
assert.Equal(t, err, nil) | ||
} | ||
|
||
func TestBatch_Get(t *testing.T) { | ||
bat, _ := insertBatch() | ||
res, err := service.Batches.Get(bat.ID).Do() | ||
pp.Println(res, err) | ||
|
||
assert.Equal(t, err, nil) | ||
} | ||
|
||
func TestBatch_Insert(t *testing.T) { | ||
_, err := insertBatch() | ||
|
||
pp.Println(err) | ||
|
||
assert.Equal(t, err, nil) | ||
} | ||
|
||
func TestBatch_Delete(t *testing.T) { | ||
bat, _ := insertBatch() | ||
err := service.Batches.Delete(bat.ID).Do() | ||
|
||
pp.Println(err) | ||
|
||
assert.Equal(t, err, nil) | ||
} | ||
|
||
func TestBatch_State(t *testing.T) { | ||
bat, _ := insertBatch() | ||
res, err := service.Batches.State(bat.ID).Do() | ||
|
||
pp.Println(res, err) | ||
|
||
assert.Equal(t, err, nil) | ||
} | ||
|
||
func TestBatch_Log(t *testing.T) { | ||
bat, _ := insertBatch() | ||
res, err := service.Batches.Log(bat.ID).Do() | ||
|
||
pp.Println(res, err) | ||
|
||
assert.Equal(t, err, nil) | ||
} | ||
|
||
func insertBatch() (*livy.Batch, error) { | ||
className := "com.example.livy.WordCount" | ||
jarPath := "/work/root-assembly-1.0.0-SNAPSHOT.jar" | ||
uid := uuid.New() | ||
return service.Batches.Insert(&livy.InsertBatchRequest{ | ||
File: fmt.Sprintf("local:%v", jarPath), | ||
ClassName: className, | ||
Name: uid.String(), | ||
}).Do() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,6 @@ services: | |
container_name: livy | ||
ports: | ||
- 8998:8998 | ||
volumes: | ||
- ./wordcount/target/scala-2.11:/work | ||
restart: always |