Files
dc/sas/sasjs/services/public/getddl.test.sas
T
dc 059cdf176a
Build / Build-and-ng-test (pull_request) Successful in 5m24s
Lighthouse Checks / lighthouse (pull_request) Successful in 21m40s
Build / Build-and-test-development (pull_request) Failing after 35m8s
fix(getddl.test): ask for a table, not a whole library
getddl requires a dataset - it aborts when the member cannot be found, and only
treats a format catalog specially - so a request with ds= always aborted and the
assertion read a stale webout.  Test 1 now names MPE_TABLES and checks that the
TSQL header names it, which keeps TSQL coverage on a request the service accepts.
2026-10-27 17:59:32 +00:00

82 lines
1.5 KiB
SAS

/**
@file
@brief testing getddl service
<h4> SAS Macros </h4>
@li mp_assertdsobs.sas
@li mx_execute.sas
**/
%let _program=&appLoc/services/public/getddl;
/* test 1 */
data work.params;
length name $32 value $1000;
name='libref';value="&dclib";output;
name='ds';value='MPE_TABLES';output;
name='flavour';value='TSQL';output;
run;
%mx_execute(&_program,
viyacontext=&defaultcontext,
inputparams=work.params,
outref=webout,
viyaresult=WEBOUT_TXT,
mdebug=&sasjs_mdebug
)
data work.results;
infile webout;
input;
putlog _infile_;
if _n_=2 then do;
if _infile_=:'/* TSQL Flavour DDL for' and index(_infile_,'MPE_TABLES')>0 then do;
putlog 'test passed';
output;
output;
end;
stop;
end;
else if _n_>2 then stop;
run;
%mp_assertdsobs(work.results,
desc=DDL file is successfully returned for a table,
test=EQUALS 2,
outds=work.test_results
)
/* test 2 - format catalog */
data work.params;
length name $32 value $1000;
name='libref';value="DCTEST";output;
name='ds';value='DCFMTS-FC';output;
run;
%mx_execute(&_program,
viyacontext=&defaultcontext,
inputparams=work.params,
outref=web2,
viyaresult=WEBOUT_TXT,
mdebug=&sasjs_mdebug
)
data work.results2;
infile web2;
input;
putlog _infile_;
if index(upcase(_infile_),'WORK.FMTEXTRACT') then do;
putlog 'test passed';
output;
output;
stop;
end;
else if _n_>50 then stop;
run;
%mp_assertdsobs(work.results2,
desc=DDL file is successfully returned from format catalog,
test=EQUALS 2,
outds=work.test_results
)