Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Be more generous validating update project #145

Merged
merged 3 commits into from
Dec 2, 2020

Conversation

honnix
Copy link
Member

@honnix honnix commented Dec 1, 2020

TL;DR

#132 added support for validating projects for both create and update. However when updating a project, it is reasonable to have some fields unset (empty string coming from gRPC). In case of archiving/activating a project, only project ID and state are required.

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

Executing for example flyte-cli archive-project -i -h <host:port> -p some-project can easily reproduce.

This PR skips validating empty string for project.Name when it is an update operation. Actually even for a create operation, it should be OK to leave project.Name unset, but to keep backward compatibility, this is still enforced.

Tracking Issue

flyteorg/flyte#336

Follow-up issue

NA

if err := ValidateEmptyStringField(project.Name, projectName); err != nil {
return err
}
return ValidateProject(project)
Copy link
Contributor

Choose a reason for hiding this comment

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

do you want to move more of the validation (e.g. description, labels, etc) out of ValidateProject and into this method?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh perhaps labels is unnecessary, but description maybe

Copy link
Member Author

Choose a reason for hiding this comment

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

We are not validating emptiness of description in VadlidateProject. Do you mean we want to enforce non-empty for description as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

ah you're right again, sorry skimmed over that

Copy link
Member Author

Choose a reason for hiding this comment

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

No worries. :)

katrogan
katrogan previously approved these changes Dec 1, 2020
@codecov-io
Copy link

codecov-io commented Dec 1, 2020

Codecov Report

Merging #145 (cc297d8) into master (8a4e199) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #145   +/-   ##
=======================================
  Coverage   61.79%   61.79%           
=======================================
  Files         105      105           
  Lines        7533     7534    +1     
=======================================
+ Hits         4655     4656    +1     
  Misses       2286     2286           
  Partials      592      592           
Flag Coverage Δ
unittests 61.79% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/manager/impl/validation/project_validator.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a4e199...cc297d8. Read the comment docs.

@honnix honnix merged commit aa420b1 into master Dec 2, 2020
@honnix honnix deleted the more-generous-when-updating-project branch December 2, 2020 07:50
eapolinario pushed a commit that referenced this pull request Sep 6, 2023
* Be more generous validating update project
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants