-
Notifications
You must be signed in to change notification settings - Fork 2k
Add strongly-typed OS model in tests #6893
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
Open
lbussell
wants to merge
14
commits into
dotnet:nightly
Choose a base branch
from
lbussell:tests-os-model
base: nightly
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Introduces OSInfo record with: - OSType enum (Linux/Windows) - OSFamily enum (Alpine, AzureLinux, Debian, Mariner, Ubuntu, NanoServer, WindowsServerCore) - Version, TagName, DisplayName, IsDistroless properties - Implicit string conversion for backward compatibility - Static instances for all existing OS constants
- Update ImageData.OS property from string to OSInfo - Update ProductImageData.SdkOS property from string to OSInfo - Add Contains() and StartsWith() methods to OSInfo for backward compatibility - Make OSType, OSFamily, and OSInfo public for use in test APIs - Update all test data arrays to use OSInfo static instances - Update pattern matching in ProductImageTests.cs to work with OSInfo - Refactor GetZLibPackage to use OSFamily enum
- Make Version property required (non-nullable string) - Remove un-versioned OSInfo instances (except AlpineFloating for samples) - Use C# record 'with' expressions to derive related records: - Alpine versions from AlpineFloating - Distroless variants from base OS (AzureLinux, Mariner, Ubuntu) - Slim variant from Bookworm - Windows version variants from base versions
- Remove DisplayName from record constructor parameters - Compute DisplayName from Family and Version using switch expression - Remove DisplayName from all with expressions and constructor calls
- Add Codename parameter for OS base tag (e.g., 'jammy', 'bookworm', 'alpine') - Add IsChiseled and IsSlim as constructor parameters (with defaults) - Compute TagName from Family, Version, Codename, and variant flags - Remove all TagName assignments from with expressions - Simplify derived OS definitions to only specify changed properties
- IsChiseled is synonymous with IsDistroless for Ubuntu (chiseled suffix) - All Debian images are slim (always append -slim suffix) - Simplify TagName computation based on Family and IsDistroless - Remove Bookworm (keep only BookwormSlim since all Debian is slim)
- Remove Codename from constructor parameters - Add GetDebianCodename and GetUbuntuCodename helper methods - Compute codename from version for Debian/Ubuntu in TagName property - Simplify static OSInfo instance definitions
- Merge GetDebianCodename and GetUbuntuCodename into GetCodename - Use tuple pattern matching on (OSFamily, version)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors the way operating system (OS) information is represented and used in image tests. The main change is replacing string-based OS identifiers with a strongly-typed
OSInforecord.This refactor sets the groundwork for more robust handling of OS versions in the test infrastructure.