diff --git a/tests/http_otlp_test.go b/tests/http_otlp_test.go index 9c8d563..20231b7 100644 --- a/tests/http_otlp_test.go +++ b/tests/http_otlp_test.go @@ -22,7 +22,6 @@ import ( "github.com/roadrunner-server/otel/v5" "github.com/roadrunner-server/server/v5" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "go.uber.org/zap" ) @@ -221,98 +220,4 @@ func TestHTTPOTLP_WithPHP(t *testing.T) { assert.Equal(t, 1, oLogger.FilterMessageSnippet("trace_id").Len()) assert.Equal(t, 1, oLogger.FilterMessageSnippet("span_id").Len()) assert.Equal(t, 1, oLogger.FilterMessageSnippet("trace_state").Len()) -} - -// should not be error on connecting -func TestHTTPOTLP_JaegerAgent(t *testing.T) { - cont := endure.New(slog.LevelDebug) - - cfg := &config.Plugin{ - Version: "2023.3.0", - Path: "configs/.rr-http-jaeger-agent.yaml", - } - - err := cont.RegisterAll( - cfg, - &logger.Plugin{}, - &server.Plugin{}, - &gzip.Plugin{}, - &httpPlugin.Plugin{}, - &otel.Plugin{}, - ) - assert.NoError(t, err) - - err = cont.Init() - if err != nil { - t.Fatal(err) - } - - ch, err := cont.Serve() - assert.NoError(t, err) - - sig := make(chan os.Signal, 1) - signal.Notify(sig, os.Interrupt, syscall.SIGINT, syscall.SIGTERM) - - wg := &sync.WaitGroup{} - wg.Add(1) - - stopCh := make(chan struct{}, 1) - - go func() { - defer wg.Done() - for { - select { - case e := <-ch: - assert.Fail(t, "error", e.Error.Error()) - err = cont.Stop() - if err != nil { - assert.FailNow(t, "error", err.Error()) - } - case <-sig: - err = cont.Stop() - if err != nil { - assert.FailNow(t, "error", err.Error()) - } - return - case <-stopCh: - // timeout - err = cont.Stop() - if err != nil { - assert.FailNow(t, "error", err.Error()) - } - return - } - } - }() - - time.Sleep(time.Second * 2) - - req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:43244", nil) - assert.NoError(t, err) - - r, err := http.DefaultClient.Do(req) - assert.NoError(t, err) - assert.NotNil(t, r) - _, err = io.ReadAll(r.Body) - assert.NoError(t, err) - assert.Equal(t, 200, r.StatusCode) - - err = r.Body.Close() - assert.NoError(t, err) - - stopCh <- struct{}{} - wg.Wait() - - req2, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:16686/api/traces?service=rr_test&lookback=20m", nil) - require.NoError(t, err) - require.NotNil(t, req2) - resp, err := http.DefaultClient.Do(req2) - require.NoError(t, err) - require.NotNil(t, resp) - require.NotNil(t, resp.Body) - require.Equal(t, http.StatusOK, resp.StatusCode) - - bd, err := io.ReadAll(resp.Body) - assert.Contains(t, string(bd), "rr_test") - _ = resp.Body.Close() -} +} \ No newline at end of file