Add a SxS test for @pulumi/pulumi to help catch when we make breaking changes to core types. (#2610)

This commit is contained in:
CyrusNajmabadi 2019-03-29 12:27:42 -07:00 committed by GitHub
parent 1f51ec00fc
commit 02f46811db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 111 additions and 3 deletions

1
.gitignore vendored
View file

@ -1,6 +1,7 @@
*.swp
/vendor/
**/node_modules/
**/bin
**/.vscode/
coverage.cov
*.coverprofile

View file

@ -1,4 +1,4 @@
/bin/
**/bin
/coverage/
/prebuilt/
/node_modules/

View file

@ -47,10 +47,13 @@ instanbul_tests::
istanbul report text-summary
istanbul report text
test_fast:: instanbul_tests
sxs_tests::
pushd tests/sxs && yarn && tsc && popd
test_fast:: sxs_tests instanbul_tests
$(GO_TEST_FAST) ${PROJECT_PKGS}
test_all:: instanbul_tests
test_all:: sxs_tests instanbul_tests
$(GO_TEST) ${PROJECT_PKGS}
dist::

View file

@ -0,0 +1,13 @@
This test validates that changes we're making in @pulumi/pulumi will be side-by-side compatible with the 'latest' version of `@pulumi/pulumi` that has already shipped.
If a change is made that is not compatible, then the process should be:
1. Ensure that the change is absolutely what we want to make.
2. Disable running this test.
3. Commit the change and update the minor version of `@pulumi/pulumi` (i.e. from 0.17.x to 0.18.0).
4. Flow this change downstream, rev'ing the minor version of all downstream packages.
5. Re-enable the test. Because there is now a new 'latest' `@pulumi/pulumi`, this test should pass.
Step '3' indicates that we've made a breaking change, and that if 0.18 is pulled in from any package, that it must be pulled in from all packages.
Step '4' is necessary so that people can pick a set of packages that all agree on using this new `@pulumi/pulumi` version. While not necessary to rev the minor version of these packages, we still do so to make it clear that there is a significant change here, and that one should not move to it as readily as they would a patch update.

View file

@ -0,0 +1,57 @@
// tslint:disable:file-header
// See README.md for information on what to do if this test fails.
import * as latestShipped from "@pulumi/pulumi";
// Note: we reference 'bin' as we want to see the typescript types with all internal information
// stripped.
import * as localUnshipped from "../../bin";
declare let latestShippedResource: latestShipped.Resource;
declare let localUnshippedResource: localUnshipped.Resource;
declare let latestShippedComponentResourceOptions: latestShipped.ComponentResourceOptions;
declare let localUnshippedComponentResourceOptions: localUnshipped.ComponentResourceOptions;
declare let latestShippedCustomResourceOptions: latestShipped.CustomResourceOptions;
declare let localUnshippedCustomResourceOptions: localUnshipped.CustomResourceOptions;
latestShippedResource = localUnshippedResource;
localUnshippedResource = latestShippedResource;
latestShippedComponentResourceOptions = localUnshippedComponentResourceOptions;
localUnshippedComponentResourceOptions = latestShippedComponentResourceOptions;
latestShippedCustomResourceOptions = localUnshippedCustomResourceOptions;
localUnshippedCustomResourceOptions = latestShippedCustomResourceOptions;
// simulate a resource similar to AWSX where there are instance methods that take
// other resources and options.
class LatestShippedResourceExample1 extends latestShipped.ComponentResource {
constructor(name: string, props: any, opts: latestShipped.ComponentResourceOptions) {
super("", name, undefined, opts);
}
public createInstance(name: string, opts: latestShipped.ComponentResourceOptions): LatestShippedResourceExample1 {
throw new Error();
}
}
class LocalUnshippedResourceExample1 extends localUnshipped.ComponentResource {
constructor(name: string, props: any, opts: localUnshipped.ComponentResourceOptions) {
super("", name, undefined, opts);
}
public createInstance(name: string, opts: localUnshipped.ComponentResourceOptions): LocalUnshippedResourceExample1 {
throw new Error();
}
}
// make sure we can at least assign these to the Resource types from different versions.
declare let latestShippedDerivedComponentResource: LatestShippedResourceExample1;
declare let localUnshippedDerivedComponentResource: LocalUnshippedResourceExample1;
latestShippedResource = localUnshippedDerivedComponentResource;
localUnshippedResource = latestShippedDerivedComponentResource;

View file

@ -0,0 +1,12 @@
{
"name": "sxs",
"version": "${VERSION}",
"license": "Apache-2.0",
"dependencies": {
"@pulumi/pulumi": "latest"
},
"devDependencies": {
"@types/node": "^10.0.0",
"typescript": "^3.0.0"
}
}

View file

@ -0,0 +1,22 @@
{
"compilerOptions": {
"outDir": "bin",
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"sourceMap": false,
"stripInternal": true,
"experimentalDecorators": true,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true,
"strictNullChecks": true,
},
"files": [
"index.ts",
]
}