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

[WIP] Implement .NET conformance testing #314

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Zaid-Ajaj
Copy link
Contributor

This PR is an initial implementation of .NET conformance tests. It extends pulumi-language-dotnet with GenerateProject, GeneratePackage and Pack

The actual tests require pulumi-test-language which is a command line Go tool from pulumi/pulumi. This I had to copy over using a new build command sync-pulumi-test-language (I don't think we want to do this so we might need to publish it and consume it from here)

It requires changes from pulumi/pulumi#16902 to correctly emit the paths and version of local dependencies.

There is a problem where the pulumi-test-language tries to assert the core sdk version but it doesn't match for some reason, so I had to disable this check for the pulumi dependency. I couldn't quite get where the version was retrieved from because when we pack Pulumi.csproj it doesn't have a version and defaults to 1.0.0 but the tests want a specific version that doesn't match (see below) cc @Frassle

// We can't just go run the pulumi-test-language package because of
// https://github.com/golang/go/issues/39172, so we build it to a temp file then run that.
binary := t.TempDir() + "/pulumi-test-language"
cmd := exec.Command("go", "build", "-C", "../cmd/pulumi-test-language", "-o", binary)
Copy link
Member

Choose a reason for hiding this comment

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

So I'm pretty sure you can go build a git address so you don't need to clone it into the repo


cmd := exec.Command(host.exec, "pack", "-c", "Release", "-o", destination)
cmd.Dir = req.PackageDirectory
cmd.Env = os.Environ()
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this the default?

}

return &pulumirpc.PackResponse{
ArtifactPath: destination,
Copy link
Member

Choose a reason for hiding this comment

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

This should return the actual nuget file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed this

Comment on lines +928 to +931
} else if !versionsMatch(expectedDependency.Version, *found) && expectedDependency.Name != "pulumi" {
return makeTestResponse(fmt.Sprintf("dependency %s has unexpected version %s, expected %s",
expectedDependency.Name, *found, expectedDependency.Version)), nil
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is where I made the change to exclude testing pulumi core sdk version, otherwise I didn't understand where the version was coming from since the nuget has v1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants