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
test: add test to images quiet flag #203
test: add test to images quiet flag #203
Conversation
Signed-off-by: Wei Fu <fhfuwei@163.com>
c.Assert(err, check.IsNil) | ||
|
||
c.Assert(qOut, check.Equals, quietOut) | ||
if match, _ := regexp.MatchString("^[0-9a-f]+\n$", qOut); !match { |
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 tried these code by using
Desktop $ cat main.go
package main
import (
"regexp"
"fmt"
)
func main(){
qOut := "123456789"
if match, _ := regexp.MatchString("^[0-9a-f]+\n$", qOut); !match {
fmt.Println("should return numeric ID, but got")
fmt.Println(qOut)
}
}
Desktop $ go run main.go
should return numeric ID, but got
123456789
I think 123456789 is a valid image ID, but the regexp will not pass.
Am I wrong?
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.
The ID is valid.
But the cli uses fmt.Println
to print so that each ID will have the Carriage
char at the end.
For the case, the qOut will contains the \n
. That is why I put the \n
before the $
in the regrex.
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.
In this case, can we make pouchd pull an image in advance in the integration test of travisCI?
@sunyuan3 @Letty5411
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.
BTW, the Windows uses \r\n
as Carriage char. I don't have env to test that. 😢 The case maybe fail in Windows...
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 am afraid no. But we have not planned running on Windows.
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! 👍
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.
@allencloud Yes, I can pull an image in advance in the integration test of travisCI.
c.Assert(err, check.IsNil) | ||
|
||
c.Assert(qOut, check.Equals, quietOut) | ||
if match, _ := regexp.MatchString("^[0-9a-f]+\n$", qOut); !match { |
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.
^[0-9a-f] : this may be changed to ^[0-9] as image ID only contains number.
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.
Hi @Letty5411 , the ID is short for SHA256-Digest which is hexadecimal. ID can contains the a-f.
@allencloud @sunyuan3 Currently, test has pulled testImage(busybox) in SetUpSuite function:
|
If we need to support |
Hi @allencloud , I have question before this PR. How to check the image information? Should we need to send a request to containerd to get information? If not, I think |
yes, We need a API to get image information and "pouch image inspect". @0x04C2 |
@skoo87 Got it. Thanks! |
I close this PR and do it in other PR. |
Signed-off-by: Wei Fu fhfuwei@163.com
1.Describe what this PR did
Add test case for
pouch images -q|--quiet
.2.Does this pull request fix one issue?
NONE
3.Describe how you did it
NONE
4.Describe how to verify it
NONE
5.Special notes for reviews
For now, we're missing
pouch rm
functionality. In local testing, I did hack-thing torm -rf /var/lib/pouch/containers
to make the clean env. It's killing me.I think the
hack/make.sh
can run pouchd in other scope before we havepouch rm
functionality.