Skip to content

Commit

Permalink
Verify /logs endpoint in e2e tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ser-io committed Sep 20, 2024
1 parent 3f9b026 commit d298e06
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
19 changes: 19 additions & 0 deletions e2etests/orchestration/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,22 @@ func verifyZipFile(filename string) error {
}
return nil
}

func VerifyLogsEndpoint(srvURL, group, name string) error {
base := fmt.Sprintf("%s/cvds/%s/%s/logs/", srvURL, group, name)
urls := []string{
base,
base + "launcher.log",
base + "kernel.log",
}
for _, v := range urls {
res, err := http.Get(v)
if err != nil {
return err
}
if res.StatusCode != http.StatusOK {
return fmt.Errorf("get %q failed with status code: %d", v, res.StatusCode)
}
}
return nil
}
3 changes: 3 additions & 0 deletions e2etests/orchestration/createlocalimage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ func TestInstance(t *testing.T) {
if createErr != nil {
t.Fatal(err)
}
if err := e2etesting.VerifyLogsEndpoint(ctx.ServiceURL, group_name, "1"); err != nil {
t.Fatalf("failed verifying /logs endpoint: %s", err)
}
want := &hoapi.CreateCVDResponse{
CVDs: []*hoapi.CVD{
&hoapi.CVD{
Expand Down
3 changes: 3 additions & 0 deletions e2etests/orchestration/createsingleinstance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ func TestCreateSingleInstance(t *testing.T) {
if createErr != nil {
t.Fatal(err)
}
if err := e2etesting.VerifyLogsEndpoint(ctx.ServiceURL, "cvd", "1"); err != nil {
t.Fatalf("failed verifying /logs endpoint: %s", err)
}
want := &hoapi.CreateCVDResponse{
CVDs: []*hoapi.CVD{
&hoapi.CVD{
Expand Down

0 comments on commit d298e06

Please sign in to comment.