mirror of
https://github.com/rancher/plugins.git
synced 2025-09-05 20:07:13 +00:00
go.mod: bump all deps
Bump all transitive and direct dependencies. Signed-off-by: Casey Callendrello <c1@caseyc.net>
This commit is contained in:
53
vendor/github.com/onsi/ginkgo/v2/internal/spec_context.go
generated
vendored
53
vendor/github.com/onsi/ginkgo/v2/internal/spec_context.go
generated
vendored
@@ -2,8 +2,6 @@ package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"github.com/onsi/ginkgo/v2/types"
|
||||
)
|
||||
@@ -17,11 +15,9 @@ type SpecContext interface {
|
||||
|
||||
type specContext struct {
|
||||
context.Context
|
||||
*ProgressReporterManager
|
||||
|
||||
cancel context.CancelFunc
|
||||
lock *sync.Mutex
|
||||
progressReporters map[int]func() string
|
||||
prCounter int
|
||||
cancel context.CancelFunc
|
||||
|
||||
suite *Suite
|
||||
}
|
||||
@@ -36,11 +32,9 @@ This is because Ginkgo needs finer control over when the context is canceled. S
|
||||
func NewSpecContext(suite *Suite) *specContext {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
sc := &specContext{
|
||||
cancel: cancel,
|
||||
suite: suite,
|
||||
lock: &sync.Mutex{},
|
||||
prCounter: 0,
|
||||
progressReporters: map[int]func() string{},
|
||||
cancel: cancel,
|
||||
suite: suite,
|
||||
ProgressReporterManager: NewProgressReporterManager(),
|
||||
}
|
||||
ctx = context.WithValue(ctx, "GINKGO_SPEC_CONTEXT", sc) //yes, yes, the go docs say don't use a string for a key... but we'd rather avoid a circular dependency between Gomega and Ginkgo
|
||||
sc.Context = ctx //thank goodness for garbage collectors that can handle circular dependencies
|
||||
@@ -51,40 +45,3 @@ func NewSpecContext(suite *Suite) *specContext {
|
||||
func (sc *specContext) SpecReport() types.SpecReport {
|
||||
return sc.suite.CurrentSpecReport()
|
||||
}
|
||||
|
||||
func (sc *specContext) AttachProgressReporter(reporter func() string) func() {
|
||||
sc.lock.Lock()
|
||||
defer sc.lock.Unlock()
|
||||
sc.prCounter += 1
|
||||
prCounter := sc.prCounter
|
||||
sc.progressReporters[prCounter] = reporter
|
||||
|
||||
return func() {
|
||||
sc.lock.Lock()
|
||||
defer sc.lock.Unlock()
|
||||
delete(sc.progressReporters, prCounter)
|
||||
}
|
||||
}
|
||||
|
||||
func (sc *specContext) QueryProgressReporters() []string {
|
||||
sc.lock.Lock()
|
||||
keys := []int{}
|
||||
for key := range sc.progressReporters {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
sort.Ints(keys)
|
||||
reporters := []func() string{}
|
||||
for _, key := range keys {
|
||||
reporters = append(reporters, sc.progressReporters[key])
|
||||
}
|
||||
sc.lock.Unlock()
|
||||
|
||||
if len(reporters) == 0 {
|
||||
return nil
|
||||
}
|
||||
out := []string{}
|
||||
for _, reporter := range reporters {
|
||||
out = append(out, reporter())
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
Reference in New Issue
Block a user