features/test/dotnet/test.sh

30 lines
934 B
Bash
Raw Normal View History

#!/bin/bash
set -e
Use dotnet-install.sh in .NET feature (#628) * Use dotnet-install.sh in .NET feature * Use latest.version files * Cleanup runtime args * Use latest.version files in tests as well * Improve tests, remove code duplication * Add stderr helper * Validate version inputs * Use suggested description Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Shorter version description Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Shorter version description Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Clean up apt lists * Verify 7.0 is latest * Fix PATH, add test for .NET global tools * Include a copy of dotnet-install.sh in the Feature * Configure useful env variables * Use stringly typed booleans * Keep imperative writing style in option hints * Update maintainers Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Move dotnet-install.sh into a vendor directory * Refactor variables * Amend * Amend 2 * Use default options from devcontainer-feature.json * Add back variables * Fix shellchek warning in fetch_latest_sdk_version * Inline install_version function * Fix ShellCheck warnings * Improve CSV parsing * Default to latest when configuring an empty version * Add support for runtime-only configurations * Move 'none' check higher up * Deduplicate helper functions, sort into files * Address the user more directly in NOTES * Remove unnecessary defaults * Replace feature -> Feature Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Add update-dotnet-install-script workflow * Apply suggestions from code review Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Don't skip ci for automated script update --------- Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
2023-09-11 21:16:24 +03:00
# Optional: Import test library bundled with the devcontainer CLI
# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
# Provides the 'check' and 'reportResults' commands.
2022-05-13 03:07:22 +03:00
source dev-container-features-test-lib
Use dotnet-install.sh in .NET feature (#628) * Use dotnet-install.sh in .NET feature * Use latest.version files * Cleanup runtime args * Use latest.version files in tests as well * Improve tests, remove code duplication * Add stderr helper * Validate version inputs * Use suggested description Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Shorter version description Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Shorter version description Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Clean up apt lists * Verify 7.0 is latest * Fix PATH, add test for .NET global tools * Include a copy of dotnet-install.sh in the Feature * Configure useful env variables * Use stringly typed booleans * Keep imperative writing style in option hints * Update maintainers Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Move dotnet-install.sh into a vendor directory * Refactor variables * Amend * Amend 2 * Use default options from devcontainer-feature.json * Add back variables * Fix shellchek warning in fetch_latest_sdk_version * Inline install_version function * Fix ShellCheck warnings * Improve CSV parsing * Default to latest when configuring an empty version * Add support for runtime-only configurations * Move 'none' check higher up * Deduplicate helper functions, sort into files * Address the user more directly in NOTES * Remove unnecessary defaults * Replace feature -> Feature Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Add update-dotnet-install-script workflow * Apply suggestions from code review Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Don't skip ci for automated script update --------- Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
2023-09-11 21:16:24 +03:00
# Feature-specific tests
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
# check <LABEL> <cmd> [args...]
source dotnet_env.sh
source dotnet_helpers.sh
Use dotnet-install.sh in .NET feature (#628) * Use dotnet-install.sh in .NET feature * Use latest.version files * Cleanup runtime args * Use latest.version files in tests as well * Improve tests, remove code duplication * Add stderr helper * Validate version inputs * Use suggested description Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Shorter version description Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Shorter version description Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Clean up apt lists * Verify 7.0 is latest * Fix PATH, add test for .NET global tools * Include a copy of dotnet-install.sh in the Feature * Configure useful env variables * Use stringly typed booleans * Keep imperative writing style in option hints * Update maintainers Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Move dotnet-install.sh into a vendor directory * Refactor variables * Amend * Amend 2 * Use default options from devcontainer-feature.json * Add back variables * Fix shellchek warning in fetch_latest_sdk_version * Inline install_version function * Fix ShellCheck warnings * Improve CSV parsing * Default to latest when configuring an empty version * Add support for runtime-only configurations * Move 'none' check higher up * Deduplicate helper functions, sort into files * Address the user more directly in NOTES * Remove unnecessary defaults * Replace feature -> Feature Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Add update-dotnet-install-script workflow * Apply suggestions from code review Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Don't skip ci for automated script update --------- Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
2023-09-11 21:16:24 +03:00
expected=$(fetch_latest_version)
Use dotnet-install.sh in .NET feature (#628) * Use dotnet-install.sh in .NET feature * Use latest.version files * Cleanup runtime args * Use latest.version files in tests as well * Improve tests, remove code duplication * Add stderr helper * Validate version inputs * Use suggested description Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Shorter version description Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Shorter version description Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Clean up apt lists * Verify 7.0 is latest * Fix PATH, add test for .NET global tools * Include a copy of dotnet-install.sh in the Feature * Configure useful env variables * Use stringly typed booleans * Keep imperative writing style in option hints * Update maintainers Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Move dotnet-install.sh into a vendor directory * Refactor variables * Amend * Amend 2 * Use default options from devcontainer-feature.json * Add back variables * Fix shellchek warning in fetch_latest_sdk_version * Inline install_version function * Fix ShellCheck warnings * Improve CSV parsing * Default to latest when configuring an empty version * Add support for runtime-only configurations * Move 'none' check higher up * Deduplicate helper functions, sort into files * Address the user more directly in NOTES * Remove unnecessary defaults * Replace feature -> Feature Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Add update-dotnet-install-script workflow * Apply suggestions from code review Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Don't skip ci for automated script update --------- Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
2023-09-11 21:16:24 +03:00
check "Latest .NET SDK version installed" \
is_dotnet_sdk_version_installed "$expected"
Use dotnet-install.sh in .NET feature (#628) * Use dotnet-install.sh in .NET feature * Use latest.version files * Cleanup runtime args * Use latest.version files in tests as well * Improve tests, remove code duplication * Add stderr helper * Validate version inputs * Use suggested description Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Shorter version description Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Shorter version description Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Clean up apt lists * Verify 7.0 is latest * Fix PATH, add test for .NET global tools * Include a copy of dotnet-install.sh in the Feature * Configure useful env variables * Use stringly typed booleans * Keep imperative writing style in option hints * Update maintainers Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Move dotnet-install.sh into a vendor directory * Refactor variables * Amend * Amend 2 * Use default options from devcontainer-feature.json * Add back variables * Fix shellchek warning in fetch_latest_sdk_version * Inline install_version function * Fix ShellCheck warnings * Improve CSV parsing * Default to latest when configuring an empty version * Add support for runtime-only configurations * Move 'none' check higher up * Deduplicate helper functions, sort into files * Address the user more directly in NOTES * Remove unnecessary defaults * Replace feature -> Feature Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Add update-dotnet-install-script workflow * Apply suggestions from code review Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Don't skip ci for automated script update --------- Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
2023-09-11 21:16:24 +03:00
# Expect this check to fail in November 2023 when .NET 8.0 becomes GA
check "It is a flavor of .NET 7.0" \
is_dotnet_sdk_version_installed "7.0"
check "Build and run example project" \
dotnet run --project projects/net7.0
# Report results
# If any of the checks above exited with a non-zero exit code, the test will fail.
reportResults