pulumi/tests
bors[bot] 274920fead
Merge #13218 #13220 #13224 #13225 #13227 #13228 #13229
13218: CLI update summary now shows after non-mandatory policy events seen. r=abhinav a=dixler

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

This change causes only mandatory policy violations to skip the summary display causing the resources changed and duration details to not be printed.

Policy Violations are categorized as `mandatory`, `disabled`, and `advisory`. We were treating all 3 as policy violations to skip displaying the update summary. Now we only use `mandatory`.

Fixes #13109 

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [x] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [x] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


13220: `pulumi new` now supports numeric stack names. r=abhinav a=dixler

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

`pulumi new` now correctly serializes a stack name of 123456 as a string in the `Pulumi.yaml` file.

Previously `123456` is interpreted as a number in YAML by default.
<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes #12136 

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [x] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [x] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


13224: Remove extra tab that convert TS outputs in JSON file r=abhinav a=mikhailshilkov

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes #10776

Examples of generated files:

tsconfig.js:

```json
{
	"compilerOptions": {
		"strict": true,
		"outDir": "bin",
		"target": "es2016",
		"module": "commonjs",
		"moduleResolution": "node",
		"sourceMap": true,
		"experimentalDecorators": true,
		"pretty": true,
		"noFallthroughCasesInSwitch": true,
		"noImplicitReturns": true,
		"forceConsistentCasingInFileNames": true
	},
	"files": [
		"index.ts",
	]
}
```

package.json

```json
{
	"name": "simple-yaml",
	"devDependencies": {
		"`@types/node":` "^14"
	},
	"dependencies": {
		"typescript": "^4.0.0",
		"`@pulumi/pulumi":` "^3.0.0",
		"`@pulumi/aws-native":` "*"
	}
}
```

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


13225: cli: Fix Markdown reference formatting issues r=abhinav a=abhinav

Fixes a couple of Markdown formatting issues
in the output of `gen-markdown`.

This is used as input to this section of the Pulumi website:
<https://www.pulumi.com/docs/cli/commands/>

Differences in gen-markdown output following this change:

    diff -u before/pulumi_logout.md after/pulumi_logout.md
    --- before/pulumi_logout.md	2023-06-20 15:20:06
    +++ after/pulumi_logout.md	2023-06-20 15:20:17
    `@@` -19,6 +19,7 `@@`
     If no URL is provided, you will be logged out of the current backend.

     If you would like to log out of all backends simultaneously, you can pass `--all`,
    +
         $ pulumi logout --all

     ```
    diff -u before/pulumi_state_delete.md after/pulumi_state_delete.md
    --- before/pulumi_state_delete.md	2023-06-20 15:20:06
    +++ after/pulumi_state_delete.md	2023-06-20 15:20:17
    `@@` -20,12 +20,15 `@@`

     Make sure that URNs are single-quoted to avoid having characters unexpectedly interpreted by the shell.

    -Example:
    -pulumi state delete 'urn:pulumi:stage::demo::eks:index:Cluster$pulumi:providers:kubernetes::eks-provider'

    -
     ```
     pulumi state delete <resource URN> [flags]
    +```
    +
    +### Examples
    +
    +```
    +pulumi state delete 'urn:pulumi:stage::demo::eks:index:Cluster$pulumi:providers:kubernetes::eks-provider'
     ```

     ### Options
    diff -u before/pulumi_state_rename.md after/pulumi_state_rename.md
    --- before/pulumi_state_rename.md	2023-06-20 15:20:06
    +++ after/pulumi_state_rename.md	2023-06-20 15:20:17
    `@@` -17,12 +17,15 `@@`

     Make sure that URNs are single-quoted to avoid having characters unexpectedly interpreted by the shell.

    -Example:
    -pulumi state rename 'urn:pulumi:stage::demo::eks:index:Cluster$pulumi:providers:kubernetes::eks-provider' new-name-here

    -
     ```
     pulumi state rename <resource URN> <new name> [flags]
    +```
    +
    +### Examples
    +
    +```
    +pulumi state rename 'urn:pulumi:stage::demo::eks:index:Cluster$pulumi:providers:kubernetes::eks-provider' new-name-here
     ```

     ### Options

Resolves #11991


13227: Fix `stack rm` removing config files for the wrong project r=abhinav a=Frassle

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes https://github.com/pulumi/pulumi/issues/12246

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [x] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


13228: Don't use printf without a fixed format string r=abhinav a=Frassle

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes https://github.com/pulumi/pulumi/issues/11990

There were a few places we were passing an already formatted string in as the format argument for printf. This replaces those calls with non-formatting print calls.

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [x] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


13229: [Snyk] Fix for 1 vulnerabilities r=abhinav a=pulumi-bot

<p>This PR was automatically created by Snyk using the credentials of a real user.</p><br /><h3>Snyk has created this PR to fix one or more vulnerable packages in the `yarn` dependencies of this project.</h3>



#### Changes included in this PR

- Changes to the following files to upgrade the vulnerable dependencies to a fixed version:
    - sdk/nodejs/package.json


#### Note for [zero-installs](https://yarnpkg.com/features/zero-installs) users

If you are using the Yarn feature [zero-installs](https://yarnpkg.com/features/zero-installs) that was introduced in Yarn V2, note that this PR does not update the `.yarn/cache/` directory meaning this code cannot be pulled and immediately developed on as one would expect for a zero-install project - you will need to run `yarn` to update the contents of the `./yarn/cache` directory. 
If you are not using zero-install you can ignore this as your flow should likely be unchanged.

<details>
<summary>⚠️ <b>Warning</b></summary>

```
Failed to update the yarn.lock, please update manually before merging.
```
</details>


#### Vulnerabilities that will be fixed
##### With an upgrade:
Severity                   | Priority Score (*)                   | Issue                   | Breaking Change                   | Exploit Maturity
:-------------------------:|-------------------------|:-------------------------|:-------------------------|:-------------------------
![medium severity](https://res.cloudinary.com/snyk/image/upload/w_20,h_20/v1561977819/icon/m.png "medium severity")  |  **658/1000**  <br/> **Why?** Proof of Concept exploit, Recently disclosed, Has a fix available, CVSS 5.3  | Regular Expression Denial of Service (ReDoS) <br/>[SNYK-JS-SEMVER-3247795](https://snyk.io/vuln/SNYK-JS-SEMVER-3247795) |  Yes  | Proof of Concept 

(*) Note that the real score may have changed since the PR was raised.











Check the changes in this PR to ensure they won't cause issues with your project.



------------



**Note:** *You are seeing this because you or someone else with access to this repository has authorized Snyk to open fix PRs.*

For more information:  <img src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiI5ZjM5MzJlOS1jYTdhLTQyMmYtODRkMi04OGQ0YmEyYjJhNzUiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjlmMzkzMmU5LWNhN2EtNDIyZi04NGQyLTg4ZDRiYTJiMmE3NSJ9fQ==" width="0" height="0"/>
🧐 [View latest project report](https://app.snyk.io/org/pulumi/project/e3f34c6a-bc17-4001-b1c7-ab15ce3940e5?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;fix-pr)

🛠 [Adjust project settings](https://app.snyk.io/org/pulumi/project/e3f34c6a-bc17-4001-b1c7-ab15ce3940e5?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;fix-pr/settings)

📚 [Read more about Snyk's upgrade and patch logic](https://support.snyk.io/hc/en-us/articles/360003891078-Snyk-patches-to-fix-vulnerabilities)

[//]: # (snyk:metadata:{"prId":"9f3932e9-ca7a-422f-84d2-88d4ba2b2a75","prPublicId":"9f3932e9-ca7a-422f-84d2-88d4ba2b2a75","dependencies":[{"name":"normalize-package-data","from":"2.5.0","to":"3.0.0"},{"name":"semver","from":"6.3.0","to":"7.5.2"}],"packageManager":"yarn","projectPublicId":"e3f34c6a-bc17-4001-b1c7-ab15ce3940e5","projectUrl":"https://app.snyk.io/org/pulumi/project/e3f34c6a-bc17-4001-b1c7-ab15ce3940e5?utm_source=github&utm_medium=referral&page=fix-pr","type":"auto","patch":[],"vulns":["SNYK-JS-SEMVER-3247795"],"upgrade":["SNYK-JS-SEMVER-3247795"],"isBreakingChange":true,"env":"prod","prType":"fix","templateVariants":["pr-warning-shown","priorityScore"],"priorityScoreList":[658],"remediationStrategy":"vuln"})

---

**Learn how to fix vulnerabilities with free interactive lessons:**

 🦉 [Regular Expression Denial of Service (ReDoS)](https://learn.snyk.io/lessons/redos/javascript/?loc&#x3D;fix-pr)


Co-authored-by: Kyle Dixler <kyle@pulumi.com>
Co-authored-by: Mikhail Shilkov <github@mikhail.io>
Co-authored-by: Abhinav Gupta <abhinav@pulumi.com>
Co-authored-by: Fraser Waters <fraser@pulumi.com>
Co-authored-by: snyk-bot <snyk-bot@snyk.io>
2023-06-22 00:05:49 +00:00
..
benchmarks/go-alias-norm all: cloudflare/circl 1.1.0 => 1.3.3 2023-05-11 13:51:01 -07:00
examples Rename "Smoke" test to "Acceptance" tests 2023-01-30 15:38:37 -05:00
integration Fix `stack rm` removing config files for the wrong project 2023-06-21 10:52:25 +01:00
testdata Make convert more lenient 2023-06-08 11:14:31 +01:00
testprovider all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
.gitignore ci: Use reduced smoke testing on Windows & macOS targets 2022-09-21 09:55:06 -07:00
README.md Rename "Smoke" test to "Acceptance" tests 2023-01-30 15:38:37 -05:00
about_test.go test: fix regex used to test Go version output in about command. (#10499) 2022-08-29 11:53:03 -07:00
config_test.go filestate: Re-add project support 2023-03-31 13:21:36 -07:00
go.mod chore: post-release go.mod updates 2023-06-17 20:57:43 +00:00
go.sum Revert "Merge #13167" 2023-06-16 15:30:18 +01:00
history_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
login_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
main_test.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
remote_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
roundtrip_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
smoke_test.go Make convert more lenient 2023-06-08 11:14:31 +01:00
stack_test.go Fixes #13128 2023-06-15 11:51:23 -07:00

README.md

Integration Tests

This module provides integration tests for the Pulumi CLI.

The tests can be run via:

make test_all

Usage of Go build tags

In order to speed up integration tests in GitHub actions, Go build tags are used to conditionally compile the desired test cases.

// integration_nodejs_test.go
//go:build (nodejs || all) && !xplatform-acceptance

// integration_nodejs_acceptance_test.go
//go:build nodejs || all