Skip to content
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

Cleanup experiment creation code in integration tests #643

Merged
merged 2 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 3 additions & 20 deletions tests/integration/golang/aim/experiment/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ package experiment

import (
"context"
"database/sql"
"net/http"
"testing"
"time"

"github.com/stretchr/testify/suite"

Expand Down Expand Up @@ -39,24 +37,9 @@ func (s *DeleteExperimentTestSuite) Test_Ok() {
s.Require().Nil(err)

experiment, err := s.ExperimentFixtures.CreateExperiment(context.Background(), &models.Experiment{
Name: "Test Experiment",
Tags: []models.ExperimentTag{
{
Key: "key1",
Value: "value1",
},
},
CreationTime: sql.NullInt64{
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
NamespaceID: namespace.ID,
LastUpdateTime: sql.NullInt64{
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
LifecycleStage: models.LifecycleStageActive,
ArtifactLocation: "/artifact/location",
Name: "Test Experiment",
NamespaceID: namespace.ID,
LifecycleStage: models.LifecycleStageActive,
})
s.Require().Nil(err)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,8 @@ func (s *GetExperimentTestSuite) Test_Ok() {
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
NamespaceID: namespace.ID,
LastUpdateTime: sql.NullInt64{
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
LifecycleStage: models.LifecycleStageActive,
ArtifactLocation: "/artifact/location",
NamespaceID: namespace.ID,
LifecycleStage: models.LifecycleStageActive,
})
s.Require().Nil(err)

Expand Down
15 changes: 2 additions & 13 deletions tests/integration/golang/aim/experiment/get_experiments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,13 @@ func (s *GetExperimentsTestSuite) Test_Ok() {
experiments := map[string]*models.Experiment{}
for i := 0; i < 5; i++ {
experiment := &models.Experiment{
Name: fmt.Sprintf("Test Experiment %d", i),
Tags: []models.ExperimentTag{
{
Key: "key1",
Value: "value1",
},
},
Name: fmt.Sprintf("Test Experiment %d", i),
NamespaceID: namespace.ID,
CreationTime: sql.NullInt64{
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
LastUpdateTime: sql.NullInt64{
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
LifecycleStage: models.LifecycleStageActive,
ArtifactLocation: "/artifact/location",
LifecycleStage: models.LifecycleStageActive,
}
experiment, err := s.ExperimentFixtures.CreateExperiment(context.Background(), experiment)
s.Require().Nil(err)
Expand Down
14 changes: 6 additions & 8 deletions tests/integration/golang/aim/namespace/flows/experiment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,9 @@ func (s *ExperimentFlowTestSuite) Test_Ok() {
s.Require().Nil(err)

experiment1, err := s.ExperimentFixtures.CreateExperiment(context.Background(), &models.Experiment{
Name: "Experiment1",
ArtifactLocation: "/artifact/location",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace1.ID,
Name: "Experiment1",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace1.ID,
})
s.Require().Nil(err)

Expand All @@ -117,10 +116,9 @@ func (s *ExperimentFlowTestSuite) Test_Ok() {
s.Require().Nil(err)

experiment2, err := s.ExperimentFixtures.CreateExperiment(context.Background(), &models.Experiment{
Name: "Experiment2",
ArtifactLocation: "/artifact/location",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace2.ID,
Name: "Experiment2",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace2.ID,
})
s.Require().Nil(err)

Expand Down
14 changes: 6 additions & 8 deletions tests/integration/golang/aim/namespace/flows/metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@ func (s *MetricFlowTestSuite) Test_Ok() {
s.Require().Nil(err)

experiment1, err := s.ExperimentFixtures.CreateExperiment(context.Background(), &models.Experiment{
Name: "Experiment1",
ArtifactLocation: "/artifact/location",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace1.ID,
Name: "Experiment1",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace1.ID,
})
s.Require().Nil(err)

Expand Down Expand Up @@ -159,10 +158,9 @@ func (s *MetricFlowTestSuite) Test_Ok() {
s.Require().Nil(err)

experiment2, err := s.ExperimentFixtures.CreateExperiment(context.Background(), &models.Experiment{
Name: "Experiment2",
ArtifactLocation: "/artifact/location",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace2.ID,
Name: "Experiment2",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace2.ID,
})
s.Require().Nil(err)

Expand Down
14 changes: 6 additions & 8 deletions tests/integration/golang/aim/namespace/flows/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,9 @@ func (s *ProjectFlowTestSuite) Test_Ok() {
s.Require().Nil(err)

experiment1, err := s.ExperimentFixtures.CreateExperiment(context.Background(), &models.Experiment{
Name: "Experiment1",
ArtifactLocation: "/artifact/location",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace1.ID,
Name: "Experiment1",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace1.ID,
})
s.Require().Nil(err)

Expand Down Expand Up @@ -154,10 +153,9 @@ func (s *ProjectFlowTestSuite) Test_Ok() {
s.Require().Nil(err)

experiment2, err := s.ExperimentFixtures.CreateExperiment(context.Background(), &models.Experiment{
Name: "Experiment2",
ArtifactLocation: "/artifact/location",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace2.ID,
Name: "Experiment2",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace2.ID,
})
s.Require().Nil(err)

Expand Down
14 changes: 6 additions & 8 deletions tests/integration/golang/aim/namespace/flows/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,9 @@ func (s *RunFlowTestSuite) Test_Ok() {
s.Require().Nil(err)

experiment1, err := s.ExperimentFixtures.CreateExperiment(context.Background(), &models.Experiment{
Name: "Experiment1",
ArtifactLocation: "/artifact/location",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace1.ID,
Name: "Experiment1",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace1.ID,
})
s.Require().Nil(err)

Expand Down Expand Up @@ -139,10 +138,9 @@ func (s *RunFlowTestSuite) Test_Ok() {
)

experiment2, err := s.ExperimentFixtures.CreateExperiment(context.Background(), &models.Experiment{
Name: "Experiment2",
ArtifactLocation: "/artifact/location",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace2.ID,
Name: "Experiment2",
LifecycleStage: models.LifecycleStageActive,
NamespaceID: namespace2.ID,
})
s.Require().Nil(err)

Expand Down
20 changes: 2 additions & 18 deletions tests/integration/golang/mlflow/artifact/list_gs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ package artifact

import (
"context"
"database/sql"
"fmt"
"strings"
"testing"
"time"

"cloud.google.com/go/storage"
"github.com/google/uuid"
Expand Down Expand Up @@ -80,22 +78,8 @@ func (s *ListArtifactGSTestSuite) Test_Ok() {
s.Run(tt.name, func() {
// 1. create test experiment.
experiment, err := s.ExperimentFixtures.CreateExperiment(context.Background(), &models.Experiment{
Name: fmt.Sprintf("Test Experiment In Bucket %s", tt.bucket),
Tags: []models.ExperimentTag{
{
Key: "key1",
Value: "value1",
},
},
NamespaceID: namespace.ID,
CreationTime: sql.NullInt64{
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
LastUpdateTime: sql.NullInt64{
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
Name: fmt.Sprintf("Test Experiment In Bucket %s", tt.bucket),
NamespaceID: namespace.ID,
LifecycleStage: models.LifecycleStageActive,
ArtifactLocation: fmt.Sprintf("gs://%s/1", tt.bucket),
})
Expand Down
20 changes: 2 additions & 18 deletions tests/integration/golang/mlflow/artifact/list_local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ package artifact

import (
"context"
"database/sql"
"fmt"
"io/fs"
"os"
"path/filepath"
"strings"
"testing"
"time"

"github.com/google/uuid"
"github.com/stretchr/testify/suite"
Expand Down Expand Up @@ -64,22 +62,8 @@ func (s *ListArtifactLocalTestSuite) Test_Ok() {
// 1. create test experiment.
experimentArtifactDir := s.T().TempDir()
experiment, err := s.ExperimentFixtures.CreateExperiment(context.Background(), &models.Experiment{
Name: fmt.Sprintf("Test Experiment In Path %s", experimentArtifactDir),
Tags: []models.ExperimentTag{
{
Key: "key1",
Value: "value1",
},
},
NamespaceID: namespace.ID,
CreationTime: sql.NullInt64{
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
LastUpdateTime: sql.NullInt64{
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
Name: fmt.Sprintf("Test Experiment In Path %s", experimentArtifactDir),
NamespaceID: namespace.ID,
LifecycleStage: models.LifecycleStageActive,
ArtifactLocation: fmt.Sprintf("%s%s", tt.prefix, experimentArtifactDir),
})
Expand Down
20 changes: 2 additions & 18 deletions tests/integration/golang/mlflow/artifact/list_s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ package artifact

import (
"context"
"database/sql"
"fmt"
"strings"
"testing"
"time"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/s3"
Expand Down Expand Up @@ -83,22 +81,8 @@ func (s *ListArtifactS3TestSuite) Test_Ok() {
s.Run(tt.name, func() {
// 1. create test experiment.
experiment, err := s.ExperimentFixtures.CreateExperiment(context.Background(), &models.Experiment{
Name: fmt.Sprintf("Test Experiment In Bucket %s", tt.bucket),
Tags: []models.ExperimentTag{
{
Key: "key1",
Value: "value1",
},
},
NamespaceID: namespace.ID,
CreationTime: sql.NullInt64{
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
LastUpdateTime: sql.NullInt64{
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
Name: fmt.Sprintf("Test Experiment In Bucket %s", tt.bucket),
NamespaceID: namespace.ID,
LifecycleStage: models.LifecycleStageActive,
ArtifactLocation: fmt.Sprintf("s3://%s/1", tt.bucket),
})
Expand Down
23 changes: 3 additions & 20 deletions tests/integration/golang/mlflow/experiment/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ package experiment

import (
"context"
"database/sql"
"fmt"
"net/http"
"testing"
"time"

"github.com/gofiber/fiber/v2"
"github.com/stretchr/testify/suite"
Expand Down Expand Up @@ -42,24 +40,9 @@ func (s *DeleteExperimentTestSuite) Test_Ok() {
s.Require().Nil(err)

experiment, err := s.ExperimentFixtures.CreateExperiment(context.Background(), &models.Experiment{
Name: "Test Experiment",
Tags: []models.ExperimentTag{
{
Key: "key1",
Value: "value1",
},
},
NamespaceID: namespace.ID,
CreationTime: sql.NullInt64{
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
LastUpdateTime: sql.NullInt64{
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
LifecycleStage: models.LifecycleStageActive,
ArtifactLocation: "/artifact/location",
Name: "Test Experiment",
NamespaceID: namespace.ID,
LifecycleStage: models.LifecycleStageActive,
})
s.Require().Nil(err)

Expand Down
23 changes: 3 additions & 20 deletions tests/integration/golang/mlflow/experiment/restore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ package experiment

import (
"context"
"database/sql"
"fmt"
"net/http"
"testing"
"time"

"github.com/gofiber/fiber/v2"
"github.com/stretchr/testify/suite"
Expand Down Expand Up @@ -42,24 +40,9 @@ func (s *RestoreExperimentTestSuite) Test_Ok() {
s.Require().Nil(err)

experiment, err := s.ExperimentFixtures.CreateExperiment(context.Background(), &models.Experiment{
Name: "Test Experiment",
Tags: []models.ExperimentTag{
{
Key: "key1",
Value: "value1",
},
},
NamespaceID: namespace.ID,
CreationTime: sql.NullInt64{
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
LastUpdateTime: sql.NullInt64{
Int64: time.Now().UTC().UnixMilli(),
Valid: true,
},
LifecycleStage: models.LifecycleStageDeleted,
ArtifactLocation: "/artifact/location",
Name: "Test Experiment",
NamespaceID: namespace.ID,
LifecycleStage: models.LifecycleStageDeleted,
})
s.Require().Nil(err)
s.Equal(models.LifecycleStageDeleted, experiment.LifecycleStage)
Expand Down
Loading