Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.

chore(samples): interactive tutorials code samples for CRUD products#149

Merged
bcoe merged 2 commits intogoogleapis:mainfrom
nmykhailets:products-crud
Mar 8, 2022
Merged

chore(samples): interactive tutorials code samples for CRUD products#149
bcoe merged 2 commits intogoogleapis:mainfrom
nmykhailets:products-crud

Conversation

@nmykhailets
Copy link
Copy Markdown
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

@nmykhailets nmykhailets requested a review from a team February 18, 2022 18:12
@generated-files-bot
Copy link
Copy Markdown

Warning: This pull request is touching the following templated files:

  • .kokoro/pre-samples-test.sh - .kokoro files are templated and should be updated in synthtool

@product-auto-label product-auto-label Bot added api: retail Issues related to the googleapis/nodejs-retail API. samples Issues that are directly related to samples. labels Feb 18, 2022
@snippet-bot
Copy link
Copy Markdown

snippet-bot Bot commented Feb 18, 2022

Here is the summary of changes.

You are about to add 9 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

Copy link
Copy Markdown
Contributor

@sofisl sofisl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me except for a few things:

  1. Environment variables during testing are pretty confusing if you're new to the repo. Unless the sample requires the use of env variables, can we move them to just be variables in the test files? And otherwise, can we include it in the test file itself (i.e., process.env.VARIABLE = 'value')?
  2. You need to run npm run fix to get rid of the linting errors.

@sofisl sofisl added the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 18, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 18, 2022
@kweinmeister kweinmeister added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 18, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 18, 2022
@kweinmeister kweinmeister added kokoro:force-run Add this label to force Kokoro to re-run the tests. owlbot:run Add this label to trigger the Owlbot post processor. labels Feb 18, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 18, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 18, 2022
@kweinmeister kweinmeister added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 18, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 18, 2022
@kweinmeister kweinmeister added kokoro:force-run Add this label to force Kokoro to re-run the tests. owlbot:run Add this label to trigger the Owlbot post processor. labels Feb 21, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 21, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 21, 2022
@nmykhailets nmykhailets force-pushed the products-crud branch 2 times, most recently from 62aec36 to 4b38384 Compare February 23, 2022 12:06
@kweinmeister kweinmeister added the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 23, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 23, 2022
@kweinmeister kweinmeister added the kokoro:run Add this label to force Kokoro to re-run the tests. label Feb 23, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Feb 23, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 23, 2022
);

// Add fulfillment places with outdated time
placeIds = ['store4'];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As explained offline, the timestamp check is per-store/place. If we use a new store id here, this update will still be allowed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

);

// Remove fulfillment places with outdated time
placeIds = ['store2'];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here to use the same place id.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use here correct place id, because created product has placeIds: ['store1', 'store2', 'store3']

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In such case we will not be able to demo this case - as if we send the same store_id the second time there store Id was already deleted and the flow of checking the timestamps will probably not executed. So I suggest to remove this stem from the tutorials and from this sample

Copy link
Copy Markdown
Contributor

@kweinmeister kweinmeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the issues flagged at the bottom of this page, e.g. creating variables that aren't used. Other than that, looks good!

@kweinmeister kweinmeister added kokoro:force-run Add this label to force Kokoro to re-run the tests. owlbot:run Add this label to trigger the Owlbot post processor. labels Feb 28, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 28, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 28, 2022
@kweinmeister kweinmeister added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 28, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 1, 2022
@kweinmeister kweinmeister added kokoro:force-run Add this label to force Kokoro to re-run the tests. owlbot:run Add this label to trigger the Owlbot post processor. labels Mar 1, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Mar 1, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 1, 2022
@t-karasova
Copy link
Copy Markdown
Contributor

In the interactive tutorials we ask our users to set the environment variables, so I assume that in the tests we need reproduce the user flow closely. from this point of view we cannot change how the variables are stored, and if we want to use process.env.VARIABLE to store the variables for tests, we will get them duplicated

@t-karasova
Copy link
Copy Markdown
Contributor

Looks good to me except for a few things:

Environment variables during testing are pretty confusing if you're new to the repo. Unless the sample requires the use of env variables, can we move them to just be variables in the test files? And otherwise, can we include it in the test file itself (i.e., process.env.VARIABLE = 'value')?
You need to run npm run fix to get rid of the linting errors.

@sofisl I don't know why I cannot see my earlier comment on this review, so I will answer one more time here, sorry if it is a duplication.
We ask our user who are going through the tutorials to set environment variables and those values are used in the code samples code. We could use the process.env.VARIABLE = 'value' in tests, but I think that the tests should simulate the user flow, and if these variables will be added they will duplicate the env variables

@kweinmeister kweinmeister added owlbot:run Add this label to trigger the Owlbot post processor. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Mar 8, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 8, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Mar 8, 2022
@nmykhailets nmykhailets requested a review from kweinmeister March 8, 2022 14:21
@bcoe bcoe merged commit fd95679 into googleapis:main Mar 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: retail Issues related to the googleapis/nodejs-retail API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants