Skip to content

Commit

Permalink
add virtual column & append operation test (#155)
Browse files Browse the repository at this point in the history
Co-authored-by: 43193589+WeiXinChan <[email protected]>
  • Loading branch information
WeiXinChan and WeiXinChan authored Jan 9, 2024
1 parent ce7c93b commit 96d04a4
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/generate_column/virtual_generate_column_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,39 @@ func TestGenerateColumn_virtual(t *testing.T) {
assert.EqualValues(t, "12", result.Value("g"))
}

func TestGenerateColumn_virtual_append(t *testing.T) {
tableName := testVirtualGenColumnTableName
defer test.DeleteTable(tableName)

// insert
rowKey := []*table.Column{table.NewColumn("c1", int32(0))}
mutateColumns := []*table.Column{
table.NewColumn("c2", "1"),
table.NewColumn("c3", "1"),
}
res, err := cli.Append(
context.TODO(),
tableName,
rowKey,
mutateColumns,
)
assert.Equal(t, nil, err)
assert.EqualValues(t, 1, res.AffectedRows())

// get
result, err := cli.Get(
context.TODO(),
tableName,
rowKey,
nil,
)
assert.Equal(t, nil, err)
assert.EqualValues(t, 0, result.Value("c1"))
assert.EqualValues(t, "1", result.Value("c2"))
assert.EqualValues(t, "1", result.Value("c3"))
assert.EqualValues(t, "11", result.Value("g"))
}

func TestGenerateColumn_virtual_with_index(t *testing.T) {
tableName := testVirtualGenColumnWithGlobalIndexTableName
defer test.DeleteTable(tableName)
Expand Down

0 comments on commit 96d04a4

Please sign in to comment.