-
Notifications
You must be signed in to change notification settings - Fork 159
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
chore: add e2e test helper for container use spec #640
Conversation
Signed-off-by: Qi Chen <aseaday@hotmail.com>
Signed-off-by: Qi Chen <aseaday@hotmail.com>
Write a e2e test code like: package e2e
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("e2e quickstart", Ordered, func() {
exampleName := "quick-start"
BeforeAll(BuildImage(exampleName))
BeforeEach(RunContainer(exampleName))
It("execute python demo.py", func() {
Expect(example(exampleName).Exec("python demo.py")).To(Equal("[2 3 4]"))
})
AfterEach(DestoryContainer(exampleName))
AfterAll(RemoveImage(exampleName))
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please move the test cases in pkg/app into the e2e, then update the CI.yaml?
) | ||
|
||
var _ = Describe("e2e quickstart", Ordered, func() { | ||
exampleName := "quick-start" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should place the example in testdata/.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should place the example in testdata/.
I just want to test all examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I could move the extra envd-quick-start
to testdata. And other tests shoule be wrote to cover the examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
examples may be complex. Personally, I prefer to test different features in different test cases. WDYT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for the contributions! I like the DSL! |
Signed-off-by: Qi Chen <aseaday@hotmail.com>
Signed-off-by: Qi Chen <aseaday@hotmail.com>
Signed-off-by: Qi Chen <aseaday@hotmail.com>
Signed-off-by: Qi Chen <aseaday@hotmail.com>
Makefile
Outdated
@@ -155,6 +155,7 @@ test: generate ## Run the tests | |||
|
|||
e2e-test: generate | |||
@go test -race -coverpkg=./pkg/app -coverprofile=e2e-coverage.out ./pkg/app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move the test suite to e2e/ directory directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I move these files to the app/, But I think it is ok for now but If we have more and more spec test may not be related those commands directly. we still need a independent location to put those specs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean move the tests in pkg/app/ to e2e/
Then all the e2e test cases are placed in the same dir.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, LOL, I am a little stupid today...
Signed-off-by: Qi Chen <aseaday@hotmail.com>
Signed-off-by: Qi Chen <aseaday@hotmail.com>
pkg/app/e2e/build_test.go
Outdated
@@ -12,14 +12,15 @@ | |||
// See the License for the specific language governing permissions and | |||
// limitations under the License. | |||
|
|||
package app | |||
package e2e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was expecting to move pkg/app to e2e/, actually. Or maybe test/e2e.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e2e seems better after I look throught some projects.
Signed-off-by: Qi Chen <aseaday@hotmail.com>
Signed-off-by: Qi Chen <aseaday@hotmail.com>
Signed-off-by: Qi Chen <aseaday@hotmail.com>
Signed-off-by: Qi Chen <aseaday@hotmail.com>
Signed-off-by: Qi Chen <aseaday@hotmail.com>
Signed-off-by: Qi Chen <aseaday@hotmail.com>
I don't know why e2e test falled and I test it local |
Sometimes it's flakey. I triggered a new build. |
This PR is for a high level tests focuse on: