adobe / adobe/aio-cli-plugin-asset-compute

Test-worker doesn't use any extra parameters provided to worker action via manifest.yml

Open
#43 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1
Forks
7
PR merge metrics
No merged PRs in 30d

Description

First of all, not sure if the right repo to raise that issue but in my opinion it fits the best. Anyway, when implementing workers to uses some 3rd party service you usually need to provide some secrets/credentials to use that service via the action parameters (via `manifest.yml`). Apparently, if such params are defined, if running the test-worker tests via `aio app test` those parameters simply does not exists - so unable to test properly any worker.

### Expected Behaviour
- Any parameter defined in manifest.yml is passed to the worker action when running test-worker

### Actual Behaviour
- Parameters from manifest.yml are simply ignored

### Steps to reproduce
You can use my sample repo to reproduce the issue: https://github.com/marcinczeczko/aio-cli-test-worker-reproducer
- It's basically a vanilla worker code generate via `aio app init`
- I added `myParam` to the `manifest.yml` and `params` argument to the worker code, as follows and then printed out to console log.
```js
exports.main = worker(async (source, rendition, params) {}
```

1. Run `aio app test`
2. Open the generate log file and fine the line (will start with `All the params:` that prints out all the action params). It will contains all the params without but no `myParam`
```
2020-10-06T09:39:41.197858382Z All the params: {
13 │ 2020-10-06T09:39:41.197882664Z source: { url: 'file.jpg' },
14 │ 2020-10-06T09:39:41.197888364Z renditions: [ { fmt: 'jpg', qlt: 10, target: undefined } ],
15 │ 2020-10-06T09:39:41.197892623Z requestId: 'Test: corrupt-input -----------------------------------------------',
16 │ 2020-10-06T09:39:41.197896726Z metrics: AssetComputeMetrics {
17 │ 2020-10-06T09:39:41.197923345Z startDate: 2020-10-06T09:39:41.073Z,
18 │ 2020-10-06T09:39:41.197928861Z params: [Circular],
19 │ 2020-10-06T09:39:41.197933175Z newRelic: NewRelic { defaultMetrics: [Object], canSendMetrics: false }
20 │ 2020-10-06T09:39:41.197956590Z },
21 │ 2020-10-06T09:39:41.197962640Z times: {}
22 │ 2020-10-06T09:39:41.197967078Z }
```
#### Platform and Version
```
System:
OS: macOS 10.15.6
CPU: (4) x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
Memory: 30.11 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 10.22.1 - ~/.asdf/installs/nodejs/10.22.1/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 6.14.6 - ~/.asdf/installs/nodejs/10.22.1/bin/npm
Virtualization:
Docker: 19.03.12 - /usr/local/bin/docker
npmGlobalPackages:
@adobe/aio-cli: 4.0.0
CLI plugins:
@adobe/aio-cli 4.0.0 (core)
@adobe/aio-cli-plugin-aem 1.0.4 (user)
@adobe/aio-cli-plugin-aep 1.0.5 (user)
@adobe/aio-cli-plugin-app 4.0.2 (core)
@adobe/aio-cli-plugin-asset-compute 1.4.3 (user)
@adobe/aio-cli-plugin-auth 2.4.0 (core)
@adobe/aio-cli-plugin-certificate 0.2.0 (core)
@adobe/aio-cli-plugin-cloudmanager 0.14.0 (user)
@adobe/aio-cli-plugin-cna 0.2.1 (user)
@adobe/aio-cli-plugin-config 2.3.0 (core)
@adobe/aio-cli-plugin-console 3.2.0 (core)
@adobe/aio-cli-plugin-events 1.1.0 (core)
@adobe/aio-cli-plugin-info 1.1.1 (core)
@adobe/aio-cli-plugin-runtime 2.0.0 (core)
@oclif/plugin-autocomplete 0.2.0 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.9.0 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
```
#### Sample Code that illustrates the problem
See my github repo: https://github.com/marcinczeczko/aio-cli-test-worker-reproducer

#### Logs taken while reproducing problem
See above.

Contributor guide

Open the contributing guide

Research direction

Start with the `aio app test` and test-worker flow, then compare how `manifest.yml` action parameters are loaded with the worker invocation. Reproduce using the linked sample repository and its `myParam` example; done means parameters defined in `manifest.yml` are available in the worker's `params` argument during test-worker runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.