Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using header configurable param in Fixed Callback results in an undefined value #2310

Closed
Tracked by #2343
lewisdaly opened this issue Jun 23, 2021 · 12 comments
Closed
Tracked by #2343
Assignees
Labels
bug Something isn't working or it has wrong behavior on a Mojaloop Core service oss-ttk Related to the Mojaloop testing toolkit test-bug This is a bug in tests or test automation framework, not a code or functionality issue
Milestone

Comments

@lewisdaly
Copy link
Contributor

Summary:
I've got the TTK set up to respond to a GET /services request with a PUT /services callback.

I want the FSPIOP-Destination header for the callback to be dynamic, based on the participant who send the GET /services. This looks like it should be possble (see screenshot below), but when I test everything the FSPIOP-Destination header is undefined.

ttk_issue_1.png

ttk_issue_2.png

ttk_issue_3.png

Severity:
(Low, Medium, High)

Priority:
(Critical, Medium, Low)

Steps to Reproduce

  1. Based on ttk config of participant-list-service in pisp repo (https://github.com/mojaloop/pisp/tree/master/docker-local/participant-list-service)
  2. In callback rules > event > FSPIOP-Destination > "Add configurable param to be the FSPIOP-Source header
  3. Send a GET /services/THIRD_PARTY_LINK call to the ttk. This should result in the FSPIOP-Destination header of the callback to be equal to the value of the FSPIOP-Source
  4. Observe that the actual FSPIOP-Destination header of the callback is undefined

Specifications

  • Component (if known): ml-testing-toolkit
  • Version: v11.8.1
  • Platform: docker, linux host
  • Subsystem:
  • Bug found/raised by: @lewisdaly

Notes:

I suspect this could have something to do with how the header keys are capitalized vs not capitalized in different places. I've also tested with many different permutations trying to access the header value object.

  • Severity when opened:
  • Priority when opened:
@lewisdaly lewisdaly added bug Something isn't working or it has wrong behavior on a Mojaloop Core service oss-ttk Related to the Mojaloop testing toolkit labels Jun 23, 2021
@vijayg10 vijayg10 self-assigned this Jun 23, 2021
@lewisdaly
Copy link
Contributor Author

@vijayg10 that screenshot shows using {$request.headers.FSPIOP-Source} but I should note that that was after I played around with it a bit.

The default value when using the "Add Configurable Parameter" button is {$request.header.FSPIOP-Source}, which is resulting in the same undefined issue noted above.

@elnyry-sam-k elnyry-sam-k added the test-bug This is a bug in tests or test automation framework, not a code or functionality issue label Jun 23, 2021
@kleyow kleyow self-assigned this Jun 24, 2021
@elnyry-sam-k elnyry-sam-k added this to the Sprint 14.5 milestone Jun 24, 2021
@kleyow
Copy link

kleyow commented Jun 24, 2021

image
image

@lewisdaly try using lower case {$request.headers.fspiop-source}.

@kleyow
Copy link

kleyow commented Jun 24, 2021

I bit weird that the inbound and outbound of the TTK have different case styles.

edit: Just reading the notes part. You are correct.

@kleyow
Copy link

kleyow commented Jun 24, 2021

Hmm. So if I remove the lowercasing of what I believe to be here https://github.com/mojaloop/ml-testing-toolkit/blob/56e58f5a0185b26a1363152843d46d873cf8f779/src/lib/rulesEngineModel.js#L314 means that we will need to update all tests/callbacks/requests that do not use the right Capitalization leading into somewhat of a breaking change for all tests that are sending requests to the TTK improperly(?), which is something that needs to be fixed anyway(?).

@lewisdaly @vijayg10 lmk what is the prefered solution. Leaving as is for now. Changing it to proper capitlization and poke everyone to make sure their heads are capitalized.

But headers arent case-sensitive. So maybe just updating the UI configurable params to be lowercase?

@vijayg10
Copy link

@kleyow In my opinion, we can check if all the incoming headers to TTK are normalised.
If that's the case, then during template variables replacement we should also normalise the variable name. Then users don't need to worry about the case in the header variables.

@kleyow
Copy link

kleyow commented Jun 24, 2021

@vijayg10 Sounds good.

@kleyow
Copy link

kleyow commented Jun 24, 2021

mojaloop/ml-testing-toolkit-ui#102

@kleyow kleyow closed this as completed Jun 29, 2021
@vijayg10 vijayg10 mentioned this issue Jul 12, 2021
59 tasks
@lewisdaly
Copy link
Contributor Author

@vijayg10 I'm still experiencing this issue. I suspect it goes deeper than the UI normalization of headers.

components:

  • ml-testing-toolkit v13.1.0
  • ml-testing-toolkit-ui: v13.0.1

Here's some more screenshots of the problem:

  • configuration: using the correct headers

ttk_1.png

  • callback logs - the FSPIOP-Destination value is still undefined in the callback

ttk_2.png

@lewisdaly lewisdaly reopened this Jul 19, 2021
@lewisdaly
Copy link
Contributor Author

Additionally, I'm noticing that when I select "Add Header" from the predefined list, the key seems to always get an extra , in front of it.

ttk_3.png

@lewisdaly
Copy link
Contributor Author

Ok, I think I see the issue. When I use the ui to set up the callback rule, it puts in {$request.header.fspiop-source} when it should be ${request.headers.fspiop-source}.

When I changed that value, the callback seemed to have the correct headers in the callback (no undefined). So perhaps this is a UI issue still.

@kleyow
Copy link

kleyow commented Jul 19, 2021

Issue should now be fixed in v13.0.2

@kleyow kleyow closed this as completed Jul 19, 2021
@vijayg10
Copy link

Thanks Kevin and Lewis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working or it has wrong behavior on a Mojaloop Core service oss-ttk Related to the Mojaloop testing toolkit test-bug This is a bug in tests or test automation framework, not a code or functionality issue
Projects
None yet
Development

No branches or pull requests

4 participants