[tilo] Minor bugfixes
* Set ProjectID when creating the Invocation so RS can associate it with our project
* Use a dummary target name in the mock RPC to create a ConfiguredTarget in logger_test.go
instead of an invocation name. Targets are the parents of ConfiguredTargets, not
invocations
* Specify Invocation and Configuration name when converting to generated proto messages.
Otherwise we can't update the entity in ResultStore.
IN-699#comment
Change-Id: I87525d1d5443e5b42abadb43a0135abe57449194
diff --git a/tilo/logger.go b/tilo/logger.go
index a2ff27d..3c132fa 100644
--- a/tilo/logger.go
+++ b/tilo/logger.go
@@ -26,7 +26,7 @@
// Invocation. Host is the hostname of the ResultStore backend.
//
// TODO(IN-699): Define constants for the ResultStore backends and document them here.
-func Start(ctx context.Context, environment resultstore.Environment) (Logger, error) {
+func Start(ctx context.Context, environment resultstore.Environment, projectID string) (Logger, error) {
// Connect to ResultStore.
svc, err := resultstore.Connect(ctx, environment)
if err != nil {
@@ -41,6 +41,7 @@
}
invocation, err := svc.CreateInvocation(ctx, &resultstore.Invocation{
+ ProjectID: projectID,
ID: uuid.New().String(),
StartTime: time.Now(),
})
@@ -326,7 +327,7 @@
return err
}
- invocationName, err := l.invocationName()
+ targetName, err := l.targetName(e.TestName)
if err != nil {
return err
}
@@ -338,7 +339,7 @@
StartTime: e.StartTime,
}
- configuredTarget, err = l.svc.CreateConfiguredTarget(ctx, configuredTarget, invocationName)
+ configuredTarget, err = l.svc.CreateConfiguredTarget(ctx, configuredTarget, targetName)
if err != nil {
return err
}
diff --git a/tilo/logger_test.go b/tilo/logger_test.go
index fd599a7..770619c 100644
--- a/tilo/logger_test.go
+++ b/tilo/logger_test.go
@@ -159,7 +159,7 @@
tester.SetTarget("test_a", "resultstore_target_name")
tester.EXPECT().
- CreateConfiguredTarget(expectedContext, expectedConfiguredTarget, "inv_name").
+ CreateConfiguredTarget(expectedContext, expectedConfiguredTarget, "resultstore_target_name").
Return(&outputConfiguredTarget, nil)
tester.EXPECT().
CreateTestAction(expectedContext, expectedTestAction, "cfg_tgt_name").
diff --git a/tilo/resultstore/entity.go b/tilo/resultstore/entity.go
index 2f927fb..5442184 100644
--- a/tilo/resultstore/entity.go
+++ b/tilo/resultstore/entity.go
@@ -89,6 +89,7 @@
func (i Invocation) ToResultStoreInvocation() *api.Invocation {
return &api.Invocation{
+ Name: i.Name,
Id: &api.Invocation_Id{
InvocationId: i.ID,
},
@@ -139,6 +140,7 @@
func (c Configuration) ToResultStoreConfiguration() *api.Configuration {
return &api.Configuration{
+ Name: c.Name,
Id: &api.Configuration_Id{
InvocationId: c.InvocationID,
ConfigurationId: c.ID,