Skip to content

Commit fe79eed

Browse files
committed
cvdr list --host ${HOST} prints valid service URL
1 parent 1149913 commit fe79eed

3 files changed

Lines changed: 17 additions & 11 deletions

File tree

e2etests/cvdr/cvdr_create_with_branch_test.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,16 @@ cvdr create \
1616
--build_target=aosp_cf_x86_64_only_phone-userdebug
1717

1818
# Check the output of cvdr list
19-
# TODO(b/448007486): cvdr list should print proper URL instead of showing <nil>.
20-
# TODO(b/448007486): cvdr list should print proper ADB connection status.
19+
# TODO(b/448209030): cvdr list should print proper ADB connection status.
2120
ACTUAL_OUTPUT=$(cvdr list --host ${HOSTNAME})
22-
EXPECTED_OUTPUT="${HOSTNAME} (<nil>/)
21+
EXPECTED_OUTPUT="${HOSTNAME} (http://localhost:8080/v1/zones/local/hosts/${HOSTNAME}/)
2322
cvd/1
2423
Status: Running
2524
ADB: not connected
2625
Displays: [720 x 1280 ( 320 )]
27-
Logs: <nil>/cvds/cvd/1/logs/"
26+
Logs: http://localhost:8080/v1/zones/local/hosts/${HOSTNAME}/cvds/cvd/1/logs/"
2827
diff <(echo ${EXPECTED_OUTPUT}) <(echo ${ACTUAL_OUTPUT})
2928

3029
# Check ADB connection
31-
# TODO(b/448007486): Retrieve serial of the device from the output of cvdr list.
30+
# TODO(b/448209030): Retrieve serial of the device from the output of cvdr list.
3231
adb shell uptime

e2etests/cvdr/cvdr_create_with_local_srcs_test.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,16 @@ cvdr create \
2727
--local_images_zip_src=${IMAGE_ZIP}
2828

2929
# Check the output of cvdr list
30-
# TODO(b/448007486): cvdr list should print proper URL instead of showing <nil>.
31-
# TODO(b/448007486): cvdr list should print proper ADB connection status.
30+
# TODO(b/448209030): cvdr list should print proper ADB connection status.
3231
ACTUAL_OUTPUT=$(cvdr list --host ${HOSTNAME})
33-
EXPECTED_OUTPUT="${HOSTNAME} (<nil>/)
32+
EXPECTED_OUTPUT="${HOSTNAME} (http://localhost:8080/v1/zones/local/hosts/${HOSTNAME}/)
3433
cvd_1/1
3534
Status: Running
3635
ADB: not connected
3736
Displays: [720 x 1280 ( 320 )]
38-
Logs: <nil>/cvds/cvd_1/1/logs/"
37+
Logs: http://localhost:8080/v1/zones/local/hosts/${HOSTNAME}/cvds/cvd_1/1/logs/"
3938
diff <(echo ${EXPECTED_OUTPUT}) <(echo ${ACTUAL_OUTPUT})
4039

4140
# Check ADB connection
42-
# TODO(b/448007486): Retrieve serial of the device from the output of cvdr list.
41+
# TODO(b/448209030): Retrieve serial of the device from the output of cvdr list.
4342
adb shell uptime

pkg/cli/cvd.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,15 @@ func listCVDsSingleHost(srvClient client.Client, controlDir, host string) ([]*Re
553553
if err != nil {
554554
merr = multierror.Append(merr, err)
555555
}
556-
result := []*RemoteHost{{Name: host, CVDs: cvds}}
556+
srvURL, err := srvClient.HostServiceURL(host)
557+
if err != nil {
558+
merr = multierror.Append(merr, fmt.Errorf("failed getting host service url: %w", err))
559+
}
560+
result := []*RemoteHost{{
561+
ServiceURL: srvURL,
562+
Name: host,
563+
CVDs: cvds,
564+
}}
557565
return result, merr
558566
}
559567

0 commit comments

Comments
 (0)