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

feature: Add E2E test base file for sealer #233

Merged
merged 1 commit into from
Jun 3, 2021

Conversation

kakaZhou719
Copy link
Member

Describe what this PR does / why we need it

Adding E2e test for sealer apply to keep our code more robust

Does this pull request fix one issue?

Describe how you did it

1, split github work flow as more jobs
2, add test framework for sealer ,will run sealer as non-root user.
3, add utils file and fixtures

Describe how to verify it

install ginkgo and config your env as readme.md said.
ginkgo -v --focus="sealer apply" test

Special notes for reviews

KubeFile, ImageName, Context, BuildType string
}

func (a *ArgsOfBuild) SetKubeFile(kubeFile string) *ArgsOfBuild {
Copy link
Member

Choose a reason for hiding this comment

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

attribution could be set using "a.KubeFile = kubeFile", why encapsulate the operation?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that's okay, because you don't know the set logic will change or not in the future.

return a
}

func (a *ArgsOfBuild) ToString() string {
Copy link
Member

Choose a reason for hiding this comment

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

If you do the operations above for implementing ArgsOfBuild in Builder mode, "ToString()" to "Build()" would be better, or just String(). just a suggestion.

Copy link
Member Author

Choose a reason for hiding this comment

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

truely, seem like "Build()" more better than "ToString()"

}

func (a *ArgsOfBuild) ToString() string {
return fmt.Sprintf("%s build -f %s -t %s -c %s -b %s", settings.DefaultSealerBin, a.KubeFile, a.ImageName, a.Context, a.BuildType)
Copy link
Member

Choose a reason for hiding this comment

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

Can we guarantee those params are not empty? if not so, maybe validate them first would be nicer.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, need to do validate .

}

func NewArgsOfBuild() *ArgsOfBuild {
return &ArgsOfBuild{}
Copy link
Member

Choose a reason for hiding this comment

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

NewArgsOfBuild is too simple, I think let call do "&ArgsOfBuild{}" would be fine.

defer func() {
err := file.Close()
if err != nil {
fmt.Println(err)
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason for fmt.Println(err) instead of logger?

Copy link
Member

@justadogistaken justadogistaken left a comment

Choose a reason for hiding this comment

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

LGTM if you've tested already

@justadogistaken justadogistaken merged commit 03ca894 into sealerio:main Jun 3, 2021
@kakaZhou719 kakaZhou719 deleted the new-e2e-test-base branch June 4, 2021 02:20
fanux pushed a commit to fanux/sealer that referenced this pull request Oct 8, 2021
bxy4543 pushed a commit to bxy4543/sealer that referenced this pull request Jun 27, 2022
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