Skip to content

Commit

Permalink
fix(backend): fix typo in reference key type (#4376)
Browse files Browse the repository at this point in the history
* Fix typo in reference key type

* well...
  • Loading branch information
frozeNinK authored and Bobgy committed Sep 4, 2020
1 parent 62bed1b commit e5f8209
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions backend/src/apiserver/resource/resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ func (r *ResourceManager) ReportWorkflowResource(workflow *util.Workflow) error
runDetail := &model.RunDetail{
Run: model.Run{
UUID: runId,
ExperimentUUID: experimentRef.ReferenceUUID,
DisplayName: workflow.Name,
Name: workflow.Name,
StorageState: api.Run_STORAGESTATE_AVAILABLE.String(),
Expand Down
2 changes: 2 additions & 0 deletions backend/src/apiserver/resource/resource_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,7 @@ func TestReportWorkflowResource_ScheduledWorkflowIDNotEmpty_Success(t *testing.T
expectedRunDetail := &model.RunDetail{
Run: model.Run{
UUID: "WORKFLOW_1",
ExperimentUUID: DefaultFakeUUID,
DisplayName: "MY_NAME",
StorageState: api.Run_STORAGESTATE_AVAILABLE.String(),
Name: "MY_NAME",
Expand Down Expand Up @@ -1447,6 +1448,7 @@ func TestReportWorkflowResource_ScheduledWorkflowIDNotEmpty_NoExperiment_Success
expectedRunDetail := &model.RunDetail{
Run: model.Run{
UUID: "WORKFLOW_1",
ExperimentUUID: DefaultFakeUUID,
DisplayName: "MY_NAME",
StorageState: api.Run_STORAGESTATE_AVAILABLE.String(),
Name: "MY_NAME",
Expand Down
2 changes: 1 addition & 1 deletion backend/src/apiserver/storage/run_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (s *RunStore) buildSelectRunsQuery(selectCount bool, opts *list.Options,
var err error

refKey := filterContext.ReferenceKey
if refKey != nil && refKey.Type == "ExperimentUUID" {
if refKey != nil && refKey.Type == common.Experiment {
// for performance reasons need to special treat experiment ID filter on runs
// currently only the run table have experiment UUID column
filteredSelectBuilder, err = list.FilterOnExperiment("run_details", runColumns,
Expand Down
19 changes: 19 additions & 0 deletions backend/src/apiserver/storage/run_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func initializeRunStore() (*DB, *RunStore) {
run1 := &model.RunDetail{
Run: model.Run{
UUID: "1",
ExperimentUUID: defaultFakeExpId,
Name: "run1",
DisplayName: "run1",
StorageState: api.Run_STORAGESTATE_AVAILABLE.String(),
Expand All @@ -60,6 +61,7 @@ func initializeRunStore() (*DB, *RunStore) {
run2 := &model.RunDetail{
Run: model.Run{
UUID: "2",
ExperimentUUID: defaultFakeExpId,
Name: "run2",
DisplayName: "run2",
StorageState: api.Run_STORAGESTATE_AVAILABLE.String(),
Expand All @@ -82,6 +84,7 @@ func initializeRunStore() (*DB, *RunStore) {
run3 := &model.RunDetail{
Run: model.Run{
UUID: "3",
ExperimentUUID: defaultFakeExpIdTwo,
Name: "run3",
DisplayName: "run3",
Namespace: "n3",
Expand Down Expand Up @@ -114,6 +117,7 @@ func TestListRuns_Pagination(t *testing.T) {
expectedFirstPageRuns := []*model.Run{
{
UUID: "1",
ExperimentUUID: defaultFakeExpId,
Name: "run1",
DisplayName: "run1",
Namespace: "n1",
Expand All @@ -132,6 +136,7 @@ func TestListRuns_Pagination(t *testing.T) {
expectedSecondPageRuns := []*model.Run{
{
UUID: "2",
ExperimentUUID: defaultFakeExpId,
Name: "run2",
DisplayName: "run2",
Namespace: "n2",
Expand Down Expand Up @@ -212,6 +217,7 @@ func TestListRuns_Pagination_Descend(t *testing.T) {
expectedFirstPageRuns := []*model.Run{
{
UUID: "2",
ExperimentUUID: defaultFakeExpId,
Name: "run2",
DisplayName: "run2",
Namespace: "n2",
Expand All @@ -230,6 +236,7 @@ func TestListRuns_Pagination_Descend(t *testing.T) {
expectedSecondPageRuns := []*model.Run{
{
UUID: "1",
ExperimentUUID: defaultFakeExpId,
Name: "run1",
DisplayName: "run1",
Namespace: "n1",
Expand Down Expand Up @@ -273,6 +280,7 @@ func TestListRuns_Pagination_LessThanPageSize(t *testing.T) {
expectedRuns := []*model.Run{
{
UUID: "1",
ExperimentUUID: defaultFakeExpId,
Name: "run1",
DisplayName: "run1",
Namespace: "n1",
Expand All @@ -290,6 +298,7 @@ func TestListRuns_Pagination_LessThanPageSize(t *testing.T) {
},
{
UUID: "2",
ExperimentUUID: defaultFakeExpId,
Name: "run2",
DisplayName: "run2",
Namespace: "n2",
Expand Down Expand Up @@ -334,6 +343,7 @@ func TestGetRun(t *testing.T) {
expectedRun := &model.RunDetail{
Run: model.Run{
UUID: "1",
ExperimentUUID: defaultFakeExpId,
Name: "run1",
DisplayName: "run1",
Namespace: "n1",
Expand Down Expand Up @@ -382,6 +392,7 @@ func TestCreateOrUpdateRun_UpdateSuccess(t *testing.T) {
expectedRun := &model.RunDetail{
Run: model.Run{
UUID: "1",
ExperimentUUID: defaultFakeExpId,
Name: "run1",
DisplayName: "run1",
Namespace: "n1",
Expand Down Expand Up @@ -419,6 +430,7 @@ func TestCreateOrUpdateRun_UpdateSuccess(t *testing.T) {
expectedRun = &model.RunDetail{
Run: model.Run{
UUID: "1",
ExperimentUUID: defaultFakeExpId,
Name: "run1",
DisplayName: "run1",
Namespace: "n1",
Expand Down Expand Up @@ -454,6 +466,7 @@ func TestCreateOrUpdateRun_CreateSuccess(t *testing.T) {
runDetail := &model.RunDetail{
Run: model.Run{
UUID: "2000",
ExperimentUUID: defaultFakeExpId,
Name: "MY_NAME",
Namespace: "MY_NAMESPACE",
CreatedAtInSec: 11,
Expand Down Expand Up @@ -481,6 +494,7 @@ func TestCreateOrUpdateRun_CreateSuccess(t *testing.T) {
expectedRun := &model.RunDetail{
Run: model.Run{
UUID: "2000",
ExperimentUUID: defaultFakeExpId,
Name: "MY_NAME",
Namespace: "MY_NAMESPACE",
CreatedAtInSec: 11,
Expand Down Expand Up @@ -553,6 +567,7 @@ func TestCreateOrUpdateRun_BadStorageStateValue(t *testing.T) {
runDetail := &model.RunDetail{
Run: model.Run{
UUID: "1",
ExperimentUUID: defaultFakeExpId,
Name: "run1",
StorageState: "bad value",
Namespace: "n1",
Expand Down Expand Up @@ -596,6 +611,7 @@ func TestTerminateRun(t *testing.T) {
expectedRun := &model.RunDetail{
Run: model.Run{
UUID: "1",
ExperimentUUID: defaultFakeExpId,
Name: "run1",
DisplayName: "run1",
Namespace: "n1",
Expand Down Expand Up @@ -730,6 +746,7 @@ func TestListRuns_WithMetrics(t *testing.T) {
expectedRuns := []*model.Run{
{
UUID: "1",
ExperimentUUID: defaultFakeExpId,
Name: "run1",
DisplayName: "run1",
Namespace: "n1",
Expand All @@ -748,6 +765,7 @@ func TestListRuns_WithMetrics(t *testing.T) {
},
{
UUID: "2",
ExperimentUUID: defaultFakeExpId,
Name: "run2",
DisplayName: "run2",
Namespace: "n2",
Expand Down Expand Up @@ -859,6 +877,7 @@ func TestArchiveRun_IncludedInRunList(t *testing.T) {
expectedRuns := []*model.Run{
{
UUID: "1",
ExperimentUUID: defaultFakeExpId,
Name: "run1",
DisplayName: "run1",
Namespace: "n1",
Expand Down

0 comments on commit e5f8209

Please sign in to comment.