Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Qualify libraries and refactor app#855

Merged
shomron merged 5 commits intoksonnet:masterfrom
shomron:qualify-libraries-and-refactor-app
Sep 11, 2018
Merged

Qualify libraries and refactor app#855
shomron merged 5 commits intoksonnet:masterfrom
shomron:qualify-libraries-and-refactor-app

Conversation

@shomron
Copy link
Collaborator

@shomron shomron commented Sep 7, 2018

Refactor schema to support explicit migrations

  • Dropped support for 0.0.1 apps
  • Versioning has been pushed up into the Schema types instead of App.
  • Added migrations framework for migrating schema versions, one hop at time

@shomron shomron force-pushed the qualify-libraries-and-refactor-app branch from 7f6bd26 to 9600bc7 Compare September 7, 2018 17:20
@shomron shomron requested a review from a team September 7, 2018 17:22
@shomron shomron force-pushed the qualify-libraries-and-refactor-app branch from 9600bc7 to 0e621d5 Compare September 7, 2018 17:25
@coveralls
Copy link

coveralls commented Sep 7, 2018

Pull Request Test Coverage Report for Build 1331

  • 760 of 1218 (62.4%) changed or added relevant lines in 20 files are covered.
  • 18 unchanged lines in 6 files lost coverage.
  • Overall coverage decreased (-0.08%) to 70.373%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/actions/actions.go 0 2 0.0%
pkg/app/schema_base.go 8 10 80.0%
pkg/registry/package_manager.go 0 3 0.0%
pkg/app/app.go 6 10 60.0%
pkg/app/override030.go 24 30 80.0%
pkg/app/schema.go 50 58 86.21%
pkg/app/override.go 34 43 79.07%
pkg/upgrade/upgrade.go 0 17 0.0%
pkg/app/override020.go 0 19 0.0%
pkg/app/migrations.go 248 284 87.32%
Files with Coverage Reduction New Missed Lines %
pkg/app/override.go 1 80.0%
pkg/app/app.go 1 67.65%
pkg/actions/registry_list.go 2 79.31%
pkg/upgrade/upgrade.go 2 0.0%
pkg/app/base_app.go 4 65.16%
pkg/app/schema.go 8 80.25%
Totals Coverage Status
Change from base Build 1323: -0.08%
Covered Lines: 12501
Relevant Lines: 17764

💛 - Coveralls

Closes ksonnet#617

Signed-off-by: Oren Shomron <shomron@gmail.com>
@shomron shomron force-pushed the qualify-libraries-and-refactor-app branch from 0e621d5 to 2c3cd5f Compare September 7, 2018 17:54
if os.IsNotExist(err) {
// During `ks init`, app.yaml will not yet exist - generate a new one.
return NewApp010(fs, appRoot, httpClient), nil
return NewBaseApp(fs, appRoot, httpClient), nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

could mock / override NewBaseApp to get some test coverage on app.Load() - not blocking just wanted to note it for future.

Copy link
Member

@bryanl bryanl left a comment

Choose a reason for hiding this comment

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

Looking further, there are multiple cases of libaryConfig* types unused.

Name: "test-migration",
Version: "0.0.1",
Description: "test migration description",
Authors: []string{
Copy link
Collaborator

Choose a reason for hiding this comment

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

can't approve of these test cases hard enough

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

😊

@shomron shomron force-pushed the qualify-libraries-and-refactor-app branch from 20f0959 to b675f9c Compare September 10, 2018 19:17
* Dropped support for 0.0.1 apps
* Versioning has been pushed up into the Schema types instead of App.
* Added migrations framework for migrating schema versions, one hop at time

Closes ksonnet#849

Signed-off-by: Oren Shomron <shomron@gmail.com>
* baseApp.load() / baseApp.save() are override-aware
* app.read() / app.write() (schema.go) are not - they only serialize/deserialize app.yaml
* baseApp.load() / baseApp.save() now call app.read() / app.write() instead of duplicating serialization logic
* Removed isOverride flag from EnvironmentConfig, RegistryConfig
* Removed override logic from app.Load() - this is handled in baseApp.load() now
* env set command now respects the --override flag to indicate where to write changes

Closes ksonnet#830

Signed-off-by: Oren Shomron <shomron@gmail.com>
* Fix panic in migrateSchema010To020, migrateSchema020To030
* Remove unused optLoadFn
* Include library qualifying conversions in 030 migration

Signed-off-by: Oren Shomron <shomron@gmail.com>
Signed-off-by: Oren Shomron <shomron@gmail.com>
@shomron shomron force-pushed the qualify-libraries-and-refactor-app branch from a36108e to 2d58dd5 Compare September 11, 2018 00:22
@shomron shomron merged commit 56b0161 into ksonnet:master Sep 11, 2018
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.

4 participants