Files
dc/sas/sasjs/services/editors/getdata.test.sas
T
dc 99ff732d67
Build / Build-and-ng-test (pull_request) Successful in 5m50s
Lighthouse Checks / lighthouse (pull_request) Successful in 22m37s
Build / Build-and-test-development (pull_request) Successful in 32m29s
fix: repair the SAS suite for the row/cell limits and default the manual deploy admin group
SAS tests:
- getcols.test: the new TYPE-vocabulary assertion had an unquoted comma in
  desc=, so the argument split and the whole test job aborted with ERROR 180.
  Quoted it with %str() - the test now runs (shown RED/GREEN against the
  length type $4 line it guards).
- getdata.test.1 (new): covers the EDIT row and cell limits. dctest.wideboy
  filtered to 300 rows trips DC_MAXOBS_WEBEDIT; filtered to 200 rows (200 x
  1005 = 201,000 cells) trips DC_MAXCELLS_WEBEDIT.
- getdata.test: test 1 fetched MPE_TABLES unfiltered, which now exceeds the
  250 row limit on a populated estate. Filtered it to one libref and moved
  the query assertion from test=NONE to test=ALL.
- exportdb.test: TSQL test now also asserts the export contains no INSERT.

Client:
- manual (Viya) deploy: the SAS Admin group dropdown was never populated
  (ngOnInit was empty). It now fetches the groups and defaults the list to
  the ones the user is a member of, with a 'Show all groups' toggle -
  mirroring the automatic deploy section. Adds three unit tests.
2026-10-05 12:05:34 +00:00

243 lines
5.0 KiB
SAS

/**
@file
@brief testing gethistory service
<h4> SAS Macros </h4>
@li mp_assertcols.sas
@li mp_assertcolvals.sas
@li mp_assertdsobs.sas
@li mf_getuniquefileref.sas
@li mf_getuniquename.sas
@li mp_filterstore.sas
@li mx_execute.sas
**/
%let _program=&appLoc/services/editors/getdata;
/**
* Test 1 - basic fetch
* The whole of MPE_TABLES is over the EDIT row limit on a populated estate,
* so fetch a single library's rows - the filter is what keeps the selection
* under the limit. The assertion is simply that data still comes back.
*/
data work.inquery1;
length GROUP_LOGIC $3 SUBGROUP_LOGIC $3 SUBGROUP_ID 8
VARIABLE_NM $32 OPERATOR_NM $10 RAW_VALUE $4000;
GROUP_LOGIC='AND';
SUBGROUP_LOGIC='AND';
SUBGROUP_ID=1;
VARIABLE_NM='LIBREF';
OPERATOR_NM='=';
RAW_VALUE="'&dclib'";
output;
run;
%mp_filterstore(
libds=&dclib..MPE_TABLES,
filter_summary=&dc_libref..mpe_filteranytable,
filter_detail=&dc_libref..mpe_filtersource,
lock_table=&dc_libref..mpe_lockanytable,
maxkeytable=&dc_libref..mpe_maxkeyvalues,
queryds=work.inquery1,
outresult=work.result1,
outquery=work.query1
)
data _null_;
set work.result1;
call symputx('filter_rk1',filter_rk,'g');
run;
%let f1=%mf_getuniquefileref();
data _null_;
file &f1 termstr=crlf;
put 'LIBDS:$43. FILTER_RK:8.';
put "&dclib..MPE_TABLES,&filter_rk1";
run;
%mx_execute(&_program,
viyacontext=&defaultcontext,
inputfiles=&f1:sascontroltable,
outlib=web1,
mdebug=&sasjs_mdebug
)
data _null_;
infile "%sysfunc(pathname(WEB1))" lrecl=32767;
input;
putlog _infile_;
run;
data sasdata;
set web1.sasdata;
data sasparams;
set web1.sasparams;
data approvers;
set web1.approvers;
data dqrules;
set web1.dqrules;
data dqdata;
set web1.dqdata;
data cols;
set web1.cols;
data maxvarlengths;
set web1.maxvarlengths;
data xl_rules;
set web1.xl_rules;
data query;
set web1.query;
run;
%mp_assertcols(work.query,
desc=Query dataset carries the filter columns,
cols=VARIABLE_NM RAW_VALUE SUBGROUP_ID,
test=ALL,
outds=work.test_results
)
%mp_assertdsobs(work.sasdata,
desc=Test1 - data is returned,
test=HASOBS,
outds=work.test_results
)
/**
* Test 2 - filtered view
*/
/* first, make filter */
data work.inquery;
infile datalines4 dsd;
input GROUP_LOGIC:$3. SUBGROUP_LOGIC:$3. SUBGROUP_ID:8. VARIABLE_NM:$32.
OPERATOR_NM:$10. RAW_VALUE:$4000.;
datalines4;
AND,AND,1,LIBREF,CONTAINS,"'DC'"
AND,OR,2,DSN,=,"'MPE_LOCK_ANYTABLE'"
;;;;
run;
%mp_filterstore(
libds=&dc_libref..MPE_TABLES,
filter_summary=&dc_libref..mpe_filteranytable,
filter_detail=&dc_libref..mpe_filtersource,
lock_table=&dc_libref..mpe_lockanytable,
maxkeytable=&dc_libref..mpe_maxkeyvalues,
queryds=work.inquery,
outresult=work.result,
outquery=work.query
)
data _null_;
set work.result;
call symputx('filter_rk',filter_rk);
run;
%let f2=%mf_getuniquefileref();
data _null_;
file &f2 termstr=crlf;
put 'LIBDS:$43. FILTER_RK:8.';
put "&dclib..MPE_TABLES,&filter_rk";
run;
%mx_execute(&_program,
viyacontext=&defaultcontext,
inputfiles=&f2:sascontroltable,
outlib=web2
)
data sasdata;
set web2.sasdata;
data query;
set web2.query;
run;
%mp_assertdsobs(work.query,
desc=Test2 - query has rows,
test=HASOBS,
outds=work.test_results
)
%mp_assertdsobs(work.sasdata,
desc=Test2 - data has just one row,
test=EQUALS 1,
outds=work.test_results
)
/**
* Test 3 - format catalog
*/
/* first, make sure format data exists */
%let fmtname=%upcase(%substr(%mf_getuniquename(prefix=FMT),1,15))NAME;
/* add formats */
data work.fmts;
length fmtname $32;
fmtname="&fmtname";
type='N';
do start=1 to 10;
label= cats("&fmtname",start);
end=start;
output;
end;
run;
proc sort data=work.fmts nodupkey;
by fmtname type start;
run;
proc format cntlin=work.fmts library=dctest.dcfmts;
run;
/* now, make filter */
data work.inquery3;
infile datalines4 dsd;
input GROUP_LOGIC:$3. SUBGROUP_LOGIC:$3. SUBGROUP_ID:8. VARIABLE_NM:$32.
OPERATOR_NM:$10. RAW_VALUE:$4000.;
RAW_VALUE="'&fmtname'";
datalines4;
AND,AND,1,FMTNAME,CONTAINS,placeholder (see line above)
;;;;
run;
%mp_filterstore(
libds=DCTEST.DCFMTS-FC,
filter_summary=&dc_libref..mpe_filteranytable,
filter_detail=&dc_libref..mpe_filtersource,
lock_table=&dc_libref..mpe_lockanytable,
maxkeytable=&dc_libref..mpe_maxkeyvalues,
queryds=work.inquery3,
outresult=work.result3,
outquery=work.query
)
data _null_;
set work.result3;
call symputx('filter_rk3',filter_rk);
run;
%let f3=%mf_getuniquefileref();
data _null_;
file &f3 termstr=crlf;
put 'LIBDS:$43. FILTER_RK:8.';
put "DCTEST.DCFMTS-FC,&filter_rk3";
run;
%mx_execute(&_program,
viyacontext=&defaultcontext,
inputfiles=&f3:sascontroltable,
outlib=web3,
mdebug=&sasjs_mdebug
)
data sasdata3;
set web3.sasdata;
putlog (_all_)(=);
data query3;
set web3.query;
run;
%mp_assertdsobs(work.query3,
desc=Test3 - format query has rows,
test=HASOBS,
outds=work.test_results
)
%mp_assertdsobs(work.sasdata3,
desc=Test3 - format data has rows,
test=EQUALS 10,
outds=work.test_results
)