1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 01:14:36 +00:00

fix: computeApi debug override

This commit is contained in:
Mihajlo Medjedovic
2020-11-24 15:19:19 +01:00
parent e36b511530
commit 011e2d83dc
5 changed files with 21 additions and 21 deletions

View File

@@ -1,9 +0,0 @@
import React from "react";
import { render } from "@testing-library/react";
import App from "./App";
test("renders learn react link", () => {
const { getByText } = render(<App />);
const linkElement = getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

View File

@@ -3,12 +3,12 @@ import { TestSuite } from "@sasjs/test-framework";
const defaultConfig: SASjsConfig = {
serverUrl: window.location.origin,
pathSAS9: "/SASStoredProcess/do",
pathSASViya: "/SASJobExecution",
appLoc: "/Public/seedapp",
pathSAS9: '/SASStoredProcess/do',
pathSASViya: '/SASJobExecution',
appLoc: '/Public/seedapp',
serverType: ServerType.SASViya,
debug: true,
contextName: "SAS Job Execution compute context",
debug: false,
contextName: 'SAS Job Execution compute context',
useComputeApi: false
};
@@ -57,6 +57,7 @@ export const basicTests = (
},
assertion: (sasjsInstance: SASjs) => {
const sasjsConfig = sasjsInstance.getSasjsConfig();
return (
sasjsConfig.serverUrl === defaultConfig.serverUrl &&
sasjsConfig.pathSAS9 === defaultConfig.pathSAS9 &&

View File

@@ -23,7 +23,7 @@ export const sasjsRequestTests = (adapter: SASjs): TestSuite => ({
},
{
title: "Make error and capture log",
description: "Should make an error and capture log",
description: "Should make an error and capture log, in the same time it is testing if debug override is working",
test: async () => {
return new Promise(async (resolve, reject) => {
adapter
@@ -33,12 +33,14 @@ export const sasjsRequestTests = (adapter: SASjs): TestSuite => ({
})
.catch((err) => {
let sasRequests = adapter.getSasRequests();
let makeErrRequest =
let makeErrRequest: any =
sasRequests.find((req) =>
req.serviceLink.includes("makeErr")
) || null;
resolve(!!makeErrRequest);
if (!makeErrRequest) resolve(false)
resolve(!!(makeErrRequest.logFile && makeErrRequest.logFile.length > 0));
});
});
},

View File

@@ -426,10 +426,10 @@ export class SASViyaApiClient {
* @param linesOfCode - an array of code lines to execute.
* @param contextName - the context to execute the code in.
* @param accessToken - an access token for an authorized user.
* @param sessionId - optional session ID to reuse.
* @param data - execution data.
* @param debug - when set to true, the log will be returned.
* @param expectWebout - when set to true, the automatic _webout fileref will be checked for content, and that content returned. This fileref is used when the Job contains a SASjs web request (as opposed to executing arbitrary SAS code).
* @param waitForResult - when set to true, function will return the session
*/
public async executeScript(
jobPath: string,
@@ -437,6 +437,7 @@ export class SASViyaApiClient {
contextName: string,
accessToken?: string,
data = null,
debug: boolean = false,
expectWebout = false,
waitForResult = true
): Promise<any> {
@@ -467,7 +468,7 @@ export class SASViyaApiClient {
_OMITTEXTLOG: true
}
if (this.debug) {
if (debug) {
jobArguments['_OMITTEXTLOG'] = false
jobArguments['_OMITSESSIONRESULTS'] = false
jobArguments['_DEBUG'] = 131
@@ -535,7 +536,7 @@ export class SASViyaApiClient {
return session
}
if (this.debug) {
if (debug) {
console.log(`Job has been submitted for '${fileName}'.`)
console.log(
`You can monitor the job progress at '${this.serverUrl}${
@@ -558,7 +559,7 @@ export class SASViyaApiClient {
const logLink = currentJob.links.find((l) => l.rel === 'log')
if (this.debug && logLink) {
if (debug && logLink) {
log = await this.request<any>(
`${this.serverUrl}${logLink.href}/content?limit=10000`,
{
@@ -633,6 +634,7 @@ export class SASViyaApiClient {
contextName,
accessToken,
data,
debug,
false,
true
)
@@ -953,6 +955,7 @@ export class SASViyaApiClient {
public async executeComputeJob(
sasJob: string,
contextName: string,
debug?: boolean,
data?: any,
accessToken?: string,
waitForResult = true,
@@ -1039,6 +1042,7 @@ export class SASViyaApiClient {
contextName,
accessToken,
data,
debug,
expectWebout,
waitForResult
)

View File

@@ -734,6 +734,7 @@ export default class SASjs {
return this.sasViyaApiClient?.executeComputeJob(
sasJob,
config.contextName,
config.debug,
data,
accessToken,
!!waitForResult,
@@ -766,6 +767,7 @@ export default class SASjs {
?.executeComputeJob(
sasJob,
config.contextName,
config.debug,
data,
accessToken,
waitForResult,