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

SNOW-1621834 Cast version to identifier when creating/dropping app versions #1475

Merged
merged 2 commits into from
Aug 23, 2024

Conversation

sfc-gh-fcampbell
Copy link
Contributor

@sfc-gh-fcampbell sfc-gh-fcampbell commented Aug 22, 2024

Pre-review checklist

  • I've confirmed that instructions included in README.md are still correct after my changes in the codebase.
  • I've added or updated automated unit tests to verify correctness of my new code.
  • I've added or updated integration tests to verify correctness of my new code.
  • I've confirmed that my changes are working by executing CLI's commands manually on MacOS.
  • I've confirmed that my changes are working by executing CLI's commands manually on Windows.
  • I've confirmed that my changes are up-to-date with the target branch.
  • I've described my changes in the release notes.
  • I've described my changes in the section below.

Changes description

When running snow app version create and snow app version drop, wrap the version in to_identifier() so users don't have to specify the quotes around version names that aren't valid identifiers. If the name is already quoted, to_identifier() doesn't do anything.

@@ -96,13 +96,13 @@ def test_process_has_no_existing_app_pkg(mock_get_existing, policy_param, temp_d
def test_process_no_version_from_user_no_version_in_manifest(
mock_version_info_in_manifest,
mock_build_bundle,
mock_mismatch,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure why this was named that

mock_get_existing,
policy_param,
temp_dir,
):

mock_mismatch.return_Value = "internal"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this didn't break the test 😅

@sfc-gh-fcampbell sfc-gh-fcampbell changed the title Cast version to identifier when creating/dropping app versions SNOW-1621834 Cast version to identifier when creating/dropping app versions Aug 22, 2024
@sfc-gh-fcampbell sfc-gh-fcampbell marked this pull request as ready for review August 22, 2024 17:58
@sfc-gh-fcampbell sfc-gh-fcampbell requested a review from a team as a code owner August 22, 2024 17:58
@@ -328,6 +327,9 @@ def process(
"Manifest.yml file does not contain a value for the version field."
)

# Make the version a valid identifier, adding quotes if necessary
version = to_identifier(version)
Copy link
Contributor

Choose a reason for hiding this comment

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

any way we can unify this to get_version() in manager or processor so we don't have to remember to do it every time, similar to get_app() or get_package() ?

Copy link
Contributor Author

@sfc-gh-fcampbell sfc-gh-fcampbell Aug 22, 2024

Choose a reason for hiding this comment

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

this also needs to handle the string passed in by the user, it's not part of the project model. I could change this to a CLI callback that casts it at that point though that wouldn't handle the version name in the manifest in case it's missing the quotes

@sfc-gh-fcampbell sfc-gh-fcampbell force-pushed the frank-quote-version-number branch from 0856ee7 to 05bff5b Compare August 23, 2024 14:46
@sfc-gh-fcampbell sfc-gh-fcampbell force-pushed the frank-quote-version-number branch from 05bff5b to d9d50f2 Compare August 23, 2024 17:07
@sfc-gh-fcampbell sfc-gh-fcampbell enabled auto-merge (squash) August 23, 2024 17:23
@sfc-gh-fcampbell sfc-gh-fcampbell merged commit ffb3faf into main Aug 23, 2024
16 checks passed
@sfc-gh-fcampbell sfc-gh-fcampbell deleted the frank-quote-version-number branch August 23, 2024 17:30
sfc-gh-jsikorski added a commit that referenced this pull request Aug 25, 2024
SNOW-1636849 Auto-teardown Native App in integration tests (#1478)

Changes `with project_directory()` to `with nativeapp_project_directory()`, which automatically runs `snow app teardown` before exiting the project. This allows us to remove the `try`/`finally` in most tests. For tests that were using `with pushd(test_project)`, this has been changed to `with nativeapp_teardown()`, which is what `with nativeapp_project_directory()` uses under the hood.

SNOW-1621834 Cast version to identifier when creating/dropping app versions (#1475)

When running `snow app version create` and `snow app version drop`, wrap the version in `to_identifier()` so users don't have to specify the quotes around version names that aren't valid identifiers. If the name is already quoted, `to_identifier()` doesn't do anything.

Added tests

Added tests
sfc-gh-jsikorski added a commit that referenced this pull request Aug 26, 2024
* Basic solution

SNOW-1636849 Auto-teardown Native App in integration tests (#1478)

Changes `with project_directory()` to `with nativeapp_project_directory()`, which automatically runs `snow app teardown` before exiting the project. This allows us to remove the `try`/`finally` in most tests. For tests that were using `with pushd(test_project)`, this has been changed to `with nativeapp_teardown()`, which is what `with nativeapp_project_directory()` uses under the hood.

SNOW-1621834 Cast version to identifier when creating/dropping app versions (#1475)

When running `snow app version create` and `snow app version drop`, wrap the version in `to_identifier()` so users don't have to specify the quotes around version names that aren't valid identifiers. If the name is already quoted, `to_identifier()` doesn't do anything.

Added tests

Added tests

* Added tests

Added tests

* Post-review-fixes
sfc-gh-jvasquezrojas pushed a commit that referenced this pull request Aug 26, 2024
* Basic solution

SNOW-1636849 Auto-teardown Native App in integration tests (#1478)

Changes `with project_directory()` to `with nativeapp_project_directory()`, which automatically runs `snow app teardown` before exiting the project. This allows us to remove the `try`/`finally` in most tests. For tests that were using `with pushd(test_project)`, this has been changed to `with nativeapp_teardown()`, which is what `with nativeapp_project_directory()` uses under the hood.

SNOW-1621834 Cast version to identifier when creating/dropping app versions (#1475)

When running `snow app version create` and `snow app version drop`, wrap the version in `to_identifier()` so users don't have to specify the quotes around version names that aren't valid identifiers. If the name is already quoted, `to_identifier()` doesn't do anything.

Added tests

Added tests

* Added tests

Added tests

* Post-review-fixes
sfc-gh-jvasquezrojas pushed a commit that referenced this pull request Aug 26, 2024
* Basic solution

SNOW-1636849 Auto-teardown Native App in integration tests (#1478)

Changes `with project_directory()` to `with nativeapp_project_directory()`, which automatically runs `snow app teardown` before exiting the project. This allows us to remove the `try`/`finally` in most tests. For tests that were using `with pushd(test_project)`, this has been changed to `with nativeapp_teardown()`, which is what `with nativeapp_project_directory()` uses under the hood.

SNOW-1621834 Cast version to identifier when creating/dropping app versions (#1475)

When running `snow app version create` and `snow app version drop`, wrap the version in `to_identifier()` so users don't have to specify the quotes around version names that aren't valid identifiers. If the name is already quoted, `to_identifier()` doesn't do anything.

Added tests

Added tests

* Added tests

Added tests

* Post-review-fixes
sfc-gh-sichen pushed a commit that referenced this pull request Oct 17, 2024
…rsions (#1475)

When running `snow app version create` and `snow app version drop`, wrap the version in `to_identifier()` so users don't have to specify the quotes around version names that aren't valid identifiers. If the name is already quoted, `to_identifier()` doesn't do anything.
sfc-gh-sichen pushed a commit that referenced this pull request Oct 17, 2024
* Basic solution

SNOW-1636849 Auto-teardown Native App in integration tests (#1478)

Changes `with project_directory()` to `with nativeapp_project_directory()`, which automatically runs `snow app teardown` before exiting the project. This allows us to remove the `try`/`finally` in most tests. For tests that were using `with pushd(test_project)`, this has been changed to `with nativeapp_teardown()`, which is what `with nativeapp_project_directory()` uses under the hood.

SNOW-1621834 Cast version to identifier when creating/dropping app versions (#1475)

When running `snow app version create` and `snow app version drop`, wrap the version in `to_identifier()` so users don't have to specify the quotes around version names that aren't valid identifiers. If the name is already quoted, `to_identifier()` doesn't do anything.

Added tests

Added tests

* Added tests

Added tests

* Post-review-fixes
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.

3 participants