提交 9afa10ba 编写于 作者: H Heikki Linnakangas

Fix unit tests for aocsam.c.

Commits a4fbb150 and 2818b911 removed the AppendOnlyEntry struct, and added
the same information into the relcache. I didn't notice there were cmocka
tests also using the AppendOnlyEntry struct.
上级 df55bb30
......@@ -17,9 +17,10 @@ test__aocs_begin_headerscan(void **state)
{
AOCSHeaderScanDesc desc;
RelationData reldata;
AppendOnlyEntry aoentry;
aoentry.version = 1;
aoentry.checksum = true;
FormData_pg_appendonly pgappendonly;
pgappendonly.version = 1;
pgappendonly.checksum = true;
reldata.rd_appendonly = &pgappendonly;
FormData_pg_class pgclass;
reldata.rd_rel = &pgclass;
StdRdOptions opt;
......@@ -46,7 +47,7 @@ test__aocs_begin_headerscan(void **state)
* desc.ao_read.
*/
will_be_called(AppendOnlyStorageRead_Init);
desc = aocs_begin_headerscan(&reldata, &aoentry, 0);
desc = aocs_begin_headerscan(&reldata, 0);
assert_false(desc->ao_read.storageAttributes.compress);
assert_int_equal(desc->colno, 0);
}
......@@ -57,7 +58,7 @@ test__aocs_addcol_init(void **state)
{
AOCSAddColumnDesc desc;
RelationData reldata;
AppendOnlyEntry aoentry;
FormData_pg_appendonly pgappendonly;
int nattr = 5;
StdRdOptions **opts =
(StdRdOptions **) malloc(sizeof(StdRdOptions *) * nattr);
......@@ -99,15 +100,16 @@ test__aocs_addcol_init(void **state)
expect_any(create_datumstreamwrite, title);
will_return_count(create_datumstreamwrite, NULL, 2);
aoentry.version = 1;
aoentry.checksum = true;
pgappendonly.version = 1;
pgappendonly.checksum = true;
reldata.rd_appendonly = &pgappendonly;
reldata.rd_att = (TupleDesc) malloc(sizeof(struct tupleDesc));
reldata.rd_att->attrs =
(Form_pg_attribute *) malloc(sizeof(Form_pg_attribute *) * nattr);
memset(reldata.rd_att->attrs, 0, sizeof(Form_pg_attribute *) * nattr);
reldata.rd_att->natts = 5;
/* 3 existing columns, 2 new columns */
desc = aocs_addcol_init(&reldata, &aoentry, 2);
desc = aocs_addcol_init(&reldata, 2);
assert_int_equal(desc->num_newcols, 2);
assert_int_equal(desc->cur_segno, -1);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册