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

Comment out unstable test #5232

Merged
merged 2 commits into from
Jul 10, 2024
Merged
Changes from 1 commit
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
120 changes: 60 additions & 60 deletions runtime/server/queries_metrics_comparison_toplist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"testing"
"time"

runtimev1 "github.com/rilldata/rill/proto/gen/rill/runtime/v1"
"github.com/rilldata/rill/runtime/pkg/activity"
Expand Down Expand Up @@ -167,65 +166,66 @@ func TestServer_MetricsViewComparison_inline_measures(t *testing.T) {
require.Equal(t, -0.5, rows[0].MeasureValues[1].DeltaRel.GetNumberValue())
}

func TestServer_MetricsViewComparison_nulls(t *testing.T) {
t.Parallel()
server, instanceId := getMetricsTestServer(t, "ad_bids_2rows")

// TODO: Support configuring at create time
_, err := server.EditInstance(testCtx(), &runtimev1.EditInstanceRequest{
InstanceId: instanceId,
Variables: map[string]string{
"rill.metrics.approximate_comparisons": "false",
},
})
require.NoError(t, err)
time.Sleep(2 * time.Second)

tr, err := server.MetricsViewComparison(testCtx(), &runtimev1.MetricsViewComparisonRequest{
InstanceId: instanceId,
MetricsViewName: "ad_bids_metrics",
Dimension: &runtimev1.MetricsViewAggregationDimension{
Name: "domain",
},
Measures: []*runtimev1.MetricsViewAggregationMeasure{
{
Name: "measure_2",
},
},
TimeRange: &runtimev1.TimeRange{
Start: parseTimeToProtoTimeStamps(t, "2022-01-02T00:00:00Z"),
End: parseTimeToProtoTimeStamps(t, "2022-01-02T23:59:00Z"),
},
ComparisonTimeRange: &runtimev1.TimeRange{
Start: parseTimeToProtoTimeStamps(t, "2022-01-01T00:00:00Z"),
End: parseTimeToProtoTimeStamps(t, "2022-01-01T23:59:00Z"),
},
Sort: []*runtimev1.MetricsViewComparisonSort{
{
Name: "measure_2",
SortType: runtimev1.MetricsViewComparisonMeasureType_METRICS_VIEW_COMPARISON_MEASURE_TYPE_BASE_VALUE,
Desc: false,
},
},
Exact: true,
})

require.NoError(t, err)
rows := tr.Rows
require.Equal(t, 2, len(rows))

require.Equal(t, "yahoo.com", rows[0].DimensionValue.GetStringValue())
require.Equal(t, 1.0, rows[0].MeasureValues[0].BaseValue.GetNumberValue())
require.Equal(t, structpb.NullValue(0), rows[0].MeasureValues[0].ComparisonValue.GetNullValue())
require.Equal(t, structpb.NullValue(0), rows[0].MeasureValues[0].DeltaAbs.GetNullValue())
require.Equal(t, structpb.NullValue(0), rows[0].MeasureValues[0].DeltaRel.GetNullValue())

require.Equal(t, "msn.com", rows[1].DimensionValue.GetStringValue())
require.Equal(t, structpb.NullValue(0), rows[1].MeasureValues[0].BaseValue.GetNullValue())
require.Equal(t, 2.0, rows[1].MeasureValues[0].ComparisonValue.GetNumberValue())
require.Equal(t, structpb.NullValue(0), rows[1].MeasureValues[0].DeltaAbs.GetNullValue())
require.Equal(t, structpb.NullValue(0), rows[1].MeasureValues[0].DeltaRel.GetNullValue())
}
// NOTE: Unstable due to sleep. Commenting until we support configuring settings at instance create time.
// func TestServer_MetricsViewComparison_nulls(t *testing.T) {
// t.Parallel()
begelundmuller marked this conversation as resolved.
Show resolved Hide resolved
// server, instanceId := getMetricsTestServer(t, "ad_bids_2rows")

// // TODO: Support configuring at create time
// _, err := server.EditInstance(testCtx(), &runtimev1.EditInstanceRequest{
// InstanceId: instanceId,
// Variables: map[string]string{
// "rill.metrics.approximate_comparisons": "false",
// },
// })
// require.NoError(t, err)
// time.Sleep(2 * time.Second)

// tr, err := server.MetricsViewComparison(testCtx(), &runtimev1.MetricsViewComparisonRequest{
// InstanceId: instanceId,
// MetricsViewName: "ad_bids_metrics",
// Dimension: &runtimev1.MetricsViewAggregationDimension{
// Name: "domain",
// },
// Measures: []*runtimev1.MetricsViewAggregationMeasure{
// {
// Name: "measure_2",
// },
// },
// TimeRange: &runtimev1.TimeRange{
// Start: parseTimeToProtoTimeStamps(t, "2022-01-02T00:00:00Z"),
// End: parseTimeToProtoTimeStamps(t, "2022-01-02T23:59:00Z"),
// },
// ComparisonTimeRange: &runtimev1.TimeRange{
// Start: parseTimeToProtoTimeStamps(t, "2022-01-01T00:00:00Z"),
// End: parseTimeToProtoTimeStamps(t, "2022-01-01T23:59:00Z"),
// },
// Sort: []*runtimev1.MetricsViewComparisonSort{
// {
// Name: "measure_2",
// SortType: runtimev1.MetricsViewComparisonMeasureType_METRICS_VIEW_COMPARISON_MEASURE_TYPE_BASE_VALUE,
// Desc: false,
// },
// },
// Exact: true,
// })

// require.NoError(t, err)
// rows := tr.Rows
// require.Equal(t, 2, len(rows))

// require.Equal(t, "yahoo.com", rows[0].DimensionValue.GetStringValue())
// require.Equal(t, 1.0, rows[0].MeasureValues[0].BaseValue.GetNumberValue())
// require.Equal(t, structpb.NullValue(0), rows[0].MeasureValues[0].ComparisonValue.GetNullValue())
// require.Equal(t, structpb.NullValue(0), rows[0].MeasureValues[0].DeltaAbs.GetNullValue())
// require.Equal(t, structpb.NullValue(0), rows[0].MeasureValues[0].DeltaRel.GetNullValue())

// require.Equal(t, "msn.com", rows[1].DimensionValue.GetStringValue())
// require.Equal(t, structpb.NullValue(0), rows[1].MeasureValues[0].BaseValue.GetNullValue())
// require.Equal(t, 2.0, rows[1].MeasureValues[0].ComparisonValue.GetNumberValue())
// require.Equal(t, structpb.NullValue(0), rows[1].MeasureValues[0].DeltaAbs.GetNullValue())
// require.Equal(t, structpb.NullValue(0), rows[1].MeasureValues[0].DeltaRel.GetNullValue())
// }

/*
model:
Expand Down
Loading