You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: parse_test.go
    path of file: ./repos/erda/internal/tools/monitor/core/metric/query/es-tsql/influxql
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package esinfluxql

import (
	"strings"
	"testing"

	"github.com/influxdata/influxql"
	"github.com/stretchr/testify/require"

	"github.com/erda-project/erda/internal/tools/monitor/core/metric/model"
	tsql "github.com/erda-project/erda/internal/tools/monitor/core/metric/query/es-tsql"
)

func TestElasticsearchParse(t *testing.T) {
	p := Parser{
		ql: influxql.NewParser(strings.NewReader("SELECT service_id::tag,type::tag,sum(count::field) FROM error_alert WHERE terminus_key::tag=$terminus_key AND service_id::tag=$service_id GROUP BY type::tag ORDER BY sum(count::field) DESC LIMIT 5")),
		ctx: &Context{
			start:          
    
func TestMetrics(t *testing.T) {
	tests := []struct {
		name   string
		stm    string
		want   []string
		params map[string]interface{}
		err    error
	}{
		{
			name: "single metric, normal stmt",
			stm:  "select * from application_http",
			want: []string{"application_http"},
		},
		{
			name: "two metric, normal stmt",
			stm:  "select * from application_http,application_rpc",
			want: []string{"application_http", "application_rpc"},
		},
		{
			name:   "two metric, real stmt",
			stm:    "SELECT sum(if(eq(error::tag, 'true'),elapsed_count::field,0))/sum(elapsed_count::field) FROM application_http,application_rpc WHERE (target_terminus_key::tag=$terminus_key OR source_terminus_key::tag=$terminus_key) AND (target_service_id::tag=$service_id OR target_service_id::tag=$service_id)  GROUP BY time()",
			params: map[string]interface{}{"terminus_key": "123", "service_id": "456"},
			want:   []string{"application_http", "application_rpc"},
		},
	}

	for _, test := range tests {
		t.Run(test.name, func(t *testing.T) {
			p := New(0, 0, test.stm, false)
			if test.params != nil {
				p.SetParams(test.params)
			}
			err := p.Build()
			require.NoError(t, err)
			got, err := p.Metrics()
			if err != test.err {
				t.Errorf("got error %v, want %v", err, test.err)
			}
			require.ElementsMatchf(t, got, test.want, "got %v, want %v", got, test.want)
		})
	}
}