func TestGetActiveSeriesForCheck(t *testing.T) {
	testcases := getTestCases()
	for checkType := range activeSeriesByCheckType {
		_, found := testcases[checkType]
		require.True(t, found, "every element in activeSeriesByCheckType must be tested")
	}
	for name, tc := range testcases {
		t.Run(name, func(t *testing.T) {
			actual, err := GetActiveSeriesForCheck(tc.input)
			require.NoError(t, err)
			require.Equal(t, activeSeriesByCheckType[tc.class], actual)
		})
	}
}
TestGetActiveSeriesForCheck verifies that GetActiveSeriesForCheck
returns the data in activeSeriesByCheckType. This makes sure that the
function is applying the correct criteria to select the entry from
the map. It also verifies that all the entries in that map are
covered.
package accounting
import (
	"path"
	"path/filepath"
	"strings"
	"testing"
	"github.com/grafana/synthetic-monitoring-agent/pkg/pb/synthetic_monitoring"
	"github.com/stretchr/testify/require"
)
func getTestCases() map[string]struct {
	input synthetic_monitoring.Check
	class string
} {
	return map[string]struct {
		input synthetic_monitoring.Check
		class string
	}{
		"dns": {
			input: synthetic_monitoring.Check{
				Target: "127.0.0.1",
				Settings: synthetic_monitoring.CheckSettings{
					Dns: &synthetic_monitoring.DnsSettings{},
				},
			},
			class: "dns",
		},
		"dns_basic": {
			input: synthetic_monitoring.Check{
				Target:           "127.0.0.1",
				BasicMetricsOnly: true,
				Settings: synthetic_monitoring.CheckSettings{
					Dns: &synthetic_monitoring.DnsSettings{},
				},
			},
			class: "dns_basic",
		},
		"http": {
			input: synthetic_monitoring.Check{
				Target: "http://127.0.0.1/",
				Settings: synthetic_monitoring.CheckSettings{
					Http: &synthetic_monitoring.HttpSettings{},
				},
			},
			class: "http",
		},
		"http_ssl": {
			input: synthetic_monitoring.Check{
				Target: "https://127.0.0.1/",
				Settings: synthetic_monitoring.CheckSettings{
					Http: &synthetic_monitoring.HttpSettings{},
				},
			},
			class: "http_ssl",
		},
		"http_basic": {
			input: synthetic_monitoring.Check{
				Target:           "http://127.0.0.1/",
				BasicMetricsOnly: true,
				Settings: synthetic_monitoring.CheckSettings{
					Http: &synthetic_monitoring.HttpSettings{},
				},
			},
			class: "http_basic",
		},
		"http_ssl_basic": {
			input: synthetic_monitoring.Check{
				Target:           "https://127.0.0.1/",
				BasicMetricsOnly: true,
				Settings: synthetic_monitoring.CheckSettings{
					Http: &synthetic_monitoring.HttpSettings{},
				},
			},
			class: "http_ssl_basic",
		},
		"ping": {
			input: synthetic_monitoring.Check{
				Target: "127.0.0.1",
				Settings: synthetic_monitoring.CheckSettings{
					Ping: &synthetic_monitoring.PingSettings{},
				},
			},
			class: "ping",
		},
		"ping_basic": {
			input: synthetic_monitoring.Check{
				Target:           "127.0.0.1",
				BasicMetricsOnly: true,
				Settings: synthetic_monitoring.CheckSettings{
					Ping: &synthetic_monitoring.PingSettings{},
				},
			},
			class: "ping_basic",
		},
		"tcp": {
			input: synthetic_monitoring.Check{
				Target: "127.0.0.1:8080",
				Settings: synthetic_monitoring.CheckSettings{
					Tcp: &synthetic_monitoring.TcpSettings{},
				},
			},
			class: "tcp",
		},
		"tcp_ssl": {
			input: synthetic_monitoring.Check{
				Target: "127.0.0.1:8080",
				Settings: synthetic_monitoring.CheckSettings{
					Tcp: &synthetic_monitoring.TcpSettings{
						Tls: true,
					},
				},
			},
			class: "tcp_ssl",
		},
		"tcp_basic": {
			input: synthetic_monitoring.Check{
				Target:           "127.0.0.1:8080",
				BasicMetricsOnly: true,
				Settings: synthetic_monitoring.CheckSettings{
					Tcp: &synthetic_monitoring.TcpSettings{},
				},
			},
			class: "tcp_basic",
		},
		"tcp_ssl_basic": {
			input: synthetic_monitoring.Check{
				Target:           "127.0.0.1:8080",
				BasicMetricsOnly: true,
				Settings: synthetic_monitoring.CheckSettings{
					Tcp: &synthetic_monitoring.TcpSettings{
						Tls: true,
					},
				},
			},
			class: "tcp_ssl_basic",
		},
		"traceroute": {
			input: synthetic_monitoring.Check{
				Target:           "127.0.0.1",
				BasicMetricsOnly: true,
				Settings: synthetic_monitoring.CheckSettings{
					Traceroute: &synthetic_monitoring.TracerouteSettings{
						MaxHops:    64,
						HopTimeout: 100,
					},
				},
			},
			class: "traceroute_basic",
		},
		"traceroute_basic": {
			input: synthetic_monitoring.Check{
				Target:           "127.0.0.1",
				BasicMetricsOnly: true,
				Settings: synthetic_monitoring.CheckSettings{
					Traceroute: &synthetic_monitoring.TracerouteSettings{
						MaxHops:    64,
						HopTimeout: 100,
					},
				},
			},
			class: "traceroute_basic",
		},
	}
}