Skip to content

Conversation

davidxia
Copy link
Contributor

@davidxia davidxia commented Nov 3, 2018

Fix failing YamlTest.testLoadAllFile()

by adding a CustomRepresenter for Quantity to Yaml.

The serialized Deployment YAML's resource requests won't necessarily be in the
same format as the original. But this PR prevents the serialization from
returning empty maps which is an improvement.

In the future, another PR can be made which could guarantee the original YAML
is returned when serializing Deployment back to YAML.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 3, 2018
@brendandburns
Copy link
Contributor

This is failing formatting check:

You need to run:

mvn fmt:format
``

Copy link
Contributor

@brendandburns brendandburns left a comment

Choose a reason for hiding this comment

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

This looks good to me, but needs formatting.

to show how V1Containers are not deserialized correctly by `Yaml.dumpAll()`.
`YamlTest.testLoadAllFile()` fails.
by adding a `CustomRepresenter` for `Quantity` to `Yaml`.

The serialized Deployment YAML's resource requests won't necessarily be in the
same format as the original. But this PR prevents the serialization from
returning empty maps which is an improvement.

In the future, another PR can be made which could guarantee the original YAML
is returned when serializing Deployment back to YAML.
@davidxia davidxia force-pushed the fix-quantity-serialization branch from 93f1427 to 12b147c Compare November 4, 2018 12:52
@davidxia davidxia changed the title Fix quantity serialization Fix Quantity serialization Nov 4, 2018
@davidxia
Copy link
Contributor Author

davidxia commented Nov 4, 2018

@brendanburns thanks. Fixed the formatting.

cpu: 500m
requests:
memory: 4Gi
cpu: '2'
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 the quotes are here. I guess it's because QuantityFormatter.toBase10String() returns a String?

@brendandburns
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 5, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, davidxia

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 5, 2018
@brendandburns
Copy link
Contributor

THanks for the PR!

@k8s-ci-robot k8s-ci-robot merged commit 6e621b2 into kubernetes-client:master Nov 5, 2018
@davidxia davidxia deleted the fix-quantity-serialization branch November 5, 2018 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants