Skip to content

Commit

Permalink
Merge pull request #6 from Astera-org/garymm/more-test
Browse files Browse the repository at this point in the history
increase test coverage of file store
  • Loading branch information
garymm authored Oct 3, 2023
2 parents 828e1f7 + 95346f1 commit 9b46214
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ func TestRun(t *testing.T) {
created, err := exp.CreateRun("run0")
require.NoError(t, err)

got, err := exp.GetRun(created.(*fileRun).RunID)
got, err := exp.GetRun(created.ID())
require.NoError(t, err)

assert.Equal(t, got.(*fileRun).RunID, created.(*fileRun).RunID)
assert.Equal(t, got.ID(), created.ID())

assert.NoError(t, got.SetName("new name"))
assert.Equal(t, "new name", got.Name())

const tagKey = "tag0"
const tagVal = "val0"
Expand All @@ -58,5 +59,25 @@ func TestRun(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, gotTag, tagVal)

metrics := []Metric{
{Key: "metric0", Val: 0.0},
{Key: "metric0", Val: 1.0},
{Key: "metric1", Val: 0.1},
}
require.NoError(t, created.LogMetrics(metrics, 0))
require.NoError(t, created.LogMetrics(metrics, 1))

params := []Param{
{Key: "param0", Val: "val0"},
{Key: "param1", Val: "val1"},
}
require.NoError(t, created.LogParams(params))
_, err = created.GetParam("param2")
require.Error(t, err)
paramVal, err := created.GetParam("param1")
require.NoError(t, err)
assert.Equal(t, paramVal, "val1")

assert.NoError(t, created.End())
assert.NoError(t, created.Fail())
}

0 comments on commit 9b46214

Please sign in to comment.