aboutsummaryrefslogtreecommitdiff
path: root/test/dotnet/install_dotnet_lts.sh
diff options
context:
space:
mode:
authorSteven <steven.liekens@gmail.com>2023-09-11 21:16:24 +0300
committerGitHub <noreply@github.com>2023-09-11 21:16:24 +0300
commit96c1eea40fc97b471ba0b33fcc79273c7ce586c7 (patch)
tree1ac35df447d38c00cb35e07a7b876dc985fc1329 /test/dotnet/install_dotnet_lts.sh
parent038bed3d58a84885da8a008b80905da17d57a543 (diff)
Use dotnet-install.sh in .NET feature (#628)feature_dotnet_2.0.0
* 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>
Diffstat (limited to 'test/dotnet/install_dotnet_lts.sh')
-rw-r--r--test/dotnet/install_dotnet_lts.sh27
1 files changed, 18 insertions, 9 deletions
diff --git a/test/dotnet/install_dotnet_lts.sh b/test/dotnet/install_dotnet_lts.sh
index 758f040..fe37b89 100644
--- a/test/dotnet/install_dotnet_lts.sh
+++ b/test/dotnet/install_dotnet_lts.sh
@@ -2,16 +2,25 @@
set -e
-# Optional: Import test library
+# 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.
source dev-container-features-test-lib
-check "dotnet sdks" dotnet --list-sdks
-check "some major version of dotnet 6 is installed" bash -c "dotnet --list-sdks | grep '6\.[0-9]*\.[0-9]*'"
-check "dotnet version 6 installed" bash -c "ls -l /usr/share/dotnet/sdk | grep '6\.[0-9]*\.[0-9]*'"
+# 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
-# Verify current symlink exists and works
-check "current link dotnet" /usr/local/dotnet/current/dotnet --info
-check "current link sdk" ls -l /usr/local/dotnet/current/sdk
+expected=$(fetch_latest_version_in_channel "LTS")
-# Report result
-reportResults
+check "Latest LTS version installed" \
+is_dotnet_sdk_version_installed "$expected"
+
+check "Build and run example project" \
+dotnet run --project projects/net6.0
+
+# Report results
+# If any of the checks above exited with a non-zero exit code, the test will fail.
+reportResults \ No newline at end of file