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

Move get-codeowners.ps1 test mode to common-tests + related improvements & cleanup #5608

Merged
22 commits merged into from
Mar 31, 2023

Conversation

konrad-jamrozik
Copy link
Contributor

@konrad-jamrozik konrad-jamrozik commented Mar 2, 2023

This PR moves the Test flag away from get-codeowners.ps1 to the established eng/common-tests infrastructure, using PowerShell Pester testing framework. As such, it solves:

This PR also:

  • adds a README for the eng/common-tests;
  • extracts the get-codeowners.lib.ps1, so that the functions can be reused between normal get-codewners.ps1 usage and through Pester unit test invocations coming from get-codeowners.tests.ps1;
  • changes some paths for related scripts and test scripts;
  • moves some default params to get-codeowners.lib.ps1 and hides some unused params; this was necessary to avoid default param value duplication between calls from get-codeowners.ps1 and from get-codeowners.tests.ps1;
  • applies some refactorings.

Associated changes made manually once this PR got merged:

Follow-up work:

@konrad-jamrozik konrad-jamrozik added the Central-EngSys This issue is owned by the Engineering System team. label Mar 2, 2023
@konrad-jamrozik konrad-jamrozik self-assigned this Mar 2, 2023
@konrad-jamrozik konrad-jamrozik requested review from weshaggard, benbp and a team March 2, 2023 23:29
@konrad-jamrozik konrad-jamrozik force-pushed the users/kojamroz/get_co_ps1_common_tests branch 2 times, most recently from 1ed0a49 to 3d46d04 Compare March 2, 2023 23:33
@konrad-jamrozik konrad-jamrozik marked this pull request as ready for review March 2, 2023 23:36
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@konrad-jamrozik konrad-jamrozik marked this pull request as draft March 2, 2023 23:54
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@konrad-jamrozik konrad-jamrozik force-pushed the users/kojamroz/get_co_ps1_common_tests branch from 6b93176 to 01c5f86 Compare March 3, 2023 17:37
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@konrad-jamrozik konrad-jamrozik marked this pull request as ready for review March 3, 2023 17:52

## When tests in this directory are executed

The PowerShell Pester unit tests will be executed by the [`tools - eng-common-tests`](https://dev.azure.com/azure-sdk/internal/_build/results?buildId=220791) pipeline
Copy link
Member

Choose a reason for hiding this comment

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

Does this need to be an internal pipeline? If it doesn't require secrets which I don't believe it does we should move it to public. That way we can have it automatically trigger for any PR.

Copy link
Contributor Author

@konrad-jamrozik konrad-jamrozik Mar 3, 2023

Choose a reason for hiding this comment

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

I created a public equivalent:
https://dev.azure.com/azure-sdk/public/_build?definitionId=5985&_a=summary

Once this PR is merged, I will delete the internal version:
https://dev.azure.com/azure-sdk/internal/_build?definitionId=5809
(update: deleted as of 3/30/2023, but since about at least 2 weeks before)

and also the internal tools eng-script-tests, which appears redundant to me:

https://dev.azure.com/azure-sdk/internal/_apps/hub/ms.vss-build-web.ci-designer-hub?pipelineId=5823

Copy link
Member

Choose a reason for hiding this comment

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

Yes we can combine them if they are doing similar things.

For the public pipeline we generally add the "- ci" postfix. So tools - eng-common-tests - ci or tools - script-tests - ci if we make it more generic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed to tools - eng-common-tests - ci. The tools - script-tests looks to be totally redundant to me, just a subset of eng-common-tests, so I will outright delete it.

Copy link
Contributor Author

@konrad-jamrozik konrad-jamrozik Mar 3, 2023

Choose a reason for hiding this comment

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

OK correction: the script-tests was running tests in eng/scripts but we have since moved all such tests to eng/common-tests. I confirmed this by invoking pester on eng/scripts - it found no tests to run.

Copy link
Member

Choose a reason for hiding this comment

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

OK I'm supportive of having just the one script testing pipeline.

Copy link
Contributor Author

@konrad-jamrozik konrad-jamrozik Mar 3, 2023

Choose a reason for hiding this comment

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

@weshaggard ungh, actually, there are tests, in:

eng\scripts\contentreplacements\tests\Repo-File-Content-Replacements\Repo-File-Content-Replacements.Tests.ps1

I was just running pester against scripts instead of eng/scripts. I have a task to merge these dirs.

In any case, I cannot delete that pipeline yet. But I am thinking to take all the tests in eng/scripts (which is just the one file above) and move them to eng/common-tests and rename eng/common-tests to e.g. eng/powershell-tests.

Does that sound reasonable?

If so, I'll make a separate PR for that, and for now hold off with any changes to the tools - script-tests pipeline.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Two things.

1. PowerShell test pipeline setup

I had a chat with @weshaggard. We should keep multiple pipelines

  • one pipeline for running PowerShell tests in /eng/common-tests/;
  • one pipeline per each language repo for running PowerShell tests in its /eng/scripts/ dir.

This is because:

  • There are two separate sets of PowerShell scripts: /eng/common/scripts/ and /eng/scripts/ and both these sets need to have tests written for them.
  • The dir /eng/scripts/ in each language repo has language-repo-specific scripts; currently they hardly have any tests, but in the future they should have more tests.

The pipelines can be sourced from different ci.yml files - the ci.yml source would differ only by parameters passed to the underlying abstraction for running Pester tests. Most importantly, the TargetDirectory would point to appropriate dir.

2. PowerShell file naming conventions

Per chat in this PR and over Teams between me, @weshaggard and @benbp we want to adopt following convention for naming files:

  • /eng/scripts/foo.ps1 and /eng/common/scripts/foo.ps1 for directly-invocable entry points;
  • /eng/scripts/foo.lib.ps1 and /eng/common/scripts/foo.lib.ps1 for dot-sourceable functions; the foo.ps1 is expected to be in practice just a delegate calling the "entry point" function from foo.lib.ps1;
  • /eng/scripts/foo.tests.ps1 and /eng/common-tests/foo.tests.ps1 for Pester tests for foo.lib.ps1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@konrad-jamrozik konrad-jamrozik changed the title Move get-codeowners test mode to common-tests Move get-codeowners test mode to common-tests + related improvements & cleanup Mar 3, 2023
@konrad-jamrozik konrad-jamrozik changed the title Move get-codeowners test mode to common-tests + related improvements & cleanup Move get-codeowners.ps1 test mode to common-tests + related improvements & cleanup Mar 3, 2023
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@konrad-jamrozik konrad-jamrozik force-pushed the users/kojamroz/get_co_ps1_common_tests branch from 0b0867d to 576805b Compare March 6, 2023 20:35
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@konrad-jamrozik konrad-jamrozik force-pushed the users/kojamroz/get_co_ps1_common_tests branch from 6bf6d2c to ffd9eed Compare March 31, 2023 05:47
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

azure-sdk added a commit to Azure/azure-sdk-for-js that referenced this pull request Mar 31, 2023
@ghost
Copy link

ghost commented Mar 31, 2023

Hello @azure-sdk!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit b5cb2ed into main Mar 31, 2023
@ghost ghost deleted the users/kojamroz/get_co_ps1_common_tests branch March 31, 2023 06:57
KarishmaGhiya pushed a commit to Azure/azure-sdk-for-js that referenced this pull request May 8, 2023
KarishmaGhiya pushed a commit to Azure/azure-sdk-for-js that referenced this pull request May 8, 2023
KarishmaGhiya pushed a commit to Azure/azure-sdk-for-js that referenced this pull request May 8, 2023
KarishmaGhiya added a commit to Azure/azure-sdk-for-js that referenced this pull request May 8, 2023
update the version and changelog

update api

update api view

fix tests

[engsys] Upgrade dev dependency `dotenv` version to `^16.0.0` for selected packages (#24020)

Update eng/common/scripts/get-codeowners.ps1

Update get-codeowners.ps1

update

Sync eng/common directory with azure-sdk-tools for PR 5608 (#25133)

Sync eng/common directory with azure-sdk-tools for PR
Azure/azure-sdk-tools#5608 See [eng/common
workflow](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/README.md#workflow)

---------

Co-authored-by: Konrad Jamrozik <[email protected]>

update changelog

Update eng/common/scripts/get-codeowners.ps1

update

update
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Central-EngSys This issue is owned by the Engineering System team.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants