Dataset Viewer
Auto-converted to Parquet Duplicate
element_type
stringclasses
4 values
project_name
stringclasses
1 value
uuid
stringlengths
36
36
name
stringlengths
0
346
imports
stringlengths
0
2.67k
structs
stringclasses
761 values
interfaces
stringclasses
22 values
file_location
stringclasses
545 values
code
stringlengths
26
8.07M
global_vars
stringclasses
7 values
package
stringclasses
124 values
tags
stringclasses
1 value
file
openshift/openshift-tests-private
a41d2a5f-a9a7-4400-a7a9-6f5e91f7b14c
e2e
import ( "strings" "time" "k8s.io/kubectl/pkg/util/templates" _ "github.com/openshift/openshift-tests-private/test/extended" "github.com/openshift/openshift-tests-private/pkg/test/ginkgo" )
github.com/openshift/openshift-tests-private/cmd/extended-platform-tests/e2e.go
package main import ( "strings" "time" "k8s.io/kubectl/pkg/util/templates" _ "github.com/openshift/openshift-tests-private/test/extended" "github.com/openshift/openshift-tests-private/pkg/test/ginkgo" ) // staticSuites are all known test suites this binary should run var staticSuites = []*ginkgo.TestSuite{ { ...
package main
file
openshift/openshift-tests-private
b2b19d80-ba8c-4898-bf2d-8eb32fca8596
openshift-tests
import ( "encoding/json" "flag" goflag "flag" "fmt" "io" "math/rand" "os" "time" "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" "github.com/spf13/cobra" "github.com/spf13/pflag" utilflag "k8s.io/component-base/cli/flag" "k8s.io/component-base/logs" "k8s.io/klog" "k8s.io/kubectl/pkg/util/template...
github.com/openshift/openshift-tests-private/cmd/extended-platform-tests/openshift-tests.go
package main import ( "encoding/json" "flag" goflag "flag" "fmt" "io" "math/rand" "os" "time" "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" "github.com/spf13/cobra" "github.com/spf13/pflag" utilflag "k8s.io/component-base/cli/flag" "k8s.io/component-base/logs" "k8s.io/klog" "k8s.io/kubectl/pkg...
package main
function
openshift/openshift-tests-private
31669808-c8aa-4546-b11c-f30b55ab5ae8
main
['"flag"', 'goflag "flag"', '"fmt"', '"math/rand"', '"os"', '"time"', '"github.com/spf13/cobra"', '"github.com/spf13/pflag"', 'utilflag "k8s.io/component-base/cli/flag"', '"k8s.io/component-base/logs"', '"k8s.io/kubectl/pkg/util/templates"', '"github.com/openshift/library-go/pkg/serviceability"']
github.com/openshift/openshift-tests-private/cmd/extended-platform-tests/openshift-tests.go
func main() { logs.InitLogs() defer logs.FlushLogs() rand.Seed(time.Now().UTC().UnixNano()) pflag.CommandLine.SetNormalizeFunc(utilflag.WordSepNormalizeFunc) pflag.CommandLine.AddGoFlagSet(goflag.CommandLine) root := &cobra.Command{ Long: templates.LongDesc(` OpenShift Extended Platform Tests This comma...
main
function
openshift/openshift-tests-private
46eb0a6c-d721-4485-a1d0-676b0dd1a5c4
newRunMonitorCommand
['"os"', '"github.com/spf13/cobra"', '"k8s.io/kubectl/pkg/util/templates"', '"github.com/openshift/openshift-tests-private/pkg/monitor"']
github.com/openshift/openshift-tests-private/cmd/extended-platform-tests/openshift-tests.go
func newRunMonitorCommand() *cobra.Command { monitorOpt := &monitor.Options{ Out: os.Stdout, ErrOut: os.Stderr, } cmd := &cobra.Command{ Use: "run-monitor", Short: "Continuously verify the cluster is functional", Long: templates.LongDesc(` Run a continuous verification process `), SilenceUsage...
main
function
openshift/openshift-tests-private
bd6e9345-95a1-4823-934e-e4e8adff5a3d
newRunCommand
['"github.com/spf13/cobra"', '"k8s.io/kubectl/pkg/util/templates"', '_ "k8s.io/kubernetes/test/e2e"']
github.com/openshift/openshift-tests-private/cmd/extended-platform-tests/openshift-tests.go
func newRunCommand() *cobra.Command { opt := &testginkgo.Options{ Suites: staticSuites, } cmd := &cobra.Command{ Use: "run SUITE", Short: "Run a test suite", Long: templates.LongDesc(` Run a test suite against an OpenShift server This command will run one of the following suites against a cluster ide...
main
function
openshift/openshift-tests-private
cec5dce3-e592-4c87-a917-a1937707c259
newRunTestCommand
['"os"', '"github.com/spf13/cobra"', '"k8s.io/kubectl/pkg/util/templates"', '_ "k8s.io/kubernetes/test/e2e"']
github.com/openshift/openshift-tests-private/cmd/extended-platform-tests/openshift-tests.go
func newRunTestCommand() *cobra.Command { testOpt := &testginkgo.TestOptions{ Out: os.Stdout, ErrOut: os.Stderr, } cmd := &cobra.Command{ Use: "run-test NAME", Short: "Run a single test by name", Long: templates.LongDesc(` Execute a single test This executes a single test by name. It is used by ...
main
function
openshift/openshift-tests-private
c9850b74-5578-4953-9474-4642bcf06ac2
checkClusterTypeAndSetEnvs
['"os"']
github.com/openshift/openshift-tests-private/cmd/extended-platform-tests/openshift-tests.go
func checkClusterTypeAndSetEnvs() { if exutil.PreSetEnvK8s() == "yes" { _ = os.Setenv(exutil.EnvIsExternalOIDCCluster, "no") } else { exutil.PreSetEnvOIDCCluster() } }
main
function
openshift/openshift-tests-private
d03e562d-3c83-408f-b2fb-767ec693dd3b
readClusterTypeEnvsAndSetFlags
['"os"', '_ "k8s.io/kubernetes/test/e2e"']
github.com/openshift/openshift-tests-private/cmd/extended-platform-tests/openshift-tests.go
func readClusterTypeEnvsAndSetFlags() { isK8sEnv := os.Getenv(exutil.EnvIsKubernetesCluster) isExtOIDCEnv := os.Getenv(exutil.EnvIsExternalOIDCCluster) if len(isK8sEnv) == 0 { isK8sEnv = exutil.PreSetEnvK8s() if isK8sEnv == "yes" { isExtOIDCEnv = "no" _ = os.Setenv(exutil.EnvIsExternalOIDCCluster, "no") ...
main
function
openshift/openshift-tests-private
f32c4698-3513-442a-ac92-87cdf21b82b8
mirrorToFile
['"fmt"', '"io"', '"os"']
github.com/openshift/openshift-tests-private/cmd/extended-platform-tests/openshift-tests.go
func mirrorToFile(opt *testginkgo.Options, fn func() error) error { if len(opt.OutFile) == 0 { opt.Out, opt.ErrOut = os.Stdout, os.Stderr return fn() } f, err := os.OpenFile(opt.OutFile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0640) if err != nil { return err } opt.Out = io.MultiWriter(os.Stdout, f) opt.ErrOu...
main
function
openshift/openshift-tests-private
7be48194-3f9c-4778-a7fe-eacc45208d2f
bindOptions
['"time"', '"github.com/spf13/pflag"']
github.com/openshift/openshift-tests-private/cmd/extended-platform-tests/openshift-tests.go
func bindOptions(opt *testginkgo.Options, flags *pflag.FlagSet) { flags.BoolVar(&opt.DryRun, "dry-run", opt.DryRun, "Print the tests to run without executing them.") flags.BoolVar(&opt.PrintCommands, "print-commands", opt.PrintCommands, "Print the sub-commands that would be executed instead.") flags.StringVar(&opt.J...
main
function
openshift/openshift-tests-private
399f69f8-3bb0-4bcb-a377-c56b08f02e87
initProvider
['"os"', '"github.com/onsi/gomega"', 'testginkgo "github.com/openshift/openshift-tests-private/pkg/test/ginkgo"', '_ "k8s.io/kubernetes/test/e2e"']
github.com/openshift/openshift-tests-private/cmd/extended-platform-tests/openshift-tests.go
func initProvider(provider string, dryRun bool) error { // record the exit error to the output file // if err := decodeProviderTo(provider, exutil.TestContext, dryRun); err != nil { // e2e.Logf("Fail to decode Provider:%s, but continue to run with skeleton mode", provider) // } exutil.TestContext.AllowedNotReadyN...
main
function
openshift/openshift-tests-private
85ac90ce-96ff-4407-b256-9237c8dd05b5
decodeProviderTo
['"encoding/json"', '"fmt"', '"os"', '"k8s.io/klog"', 'exutilcloud "github.com/openshift/openshift-tests-private/test/extended/util/cloud"', '_ "k8s.io/kubernetes/test/e2e"']
github.com/openshift/openshift-tests-private/cmd/extended-platform-tests/openshift-tests.go
func decodeProviderTo(provider string, testContext *e2e.TestContextType, dryRun bool) error { switch provider { case "": if _, ok := os.LookupEnv("KUBE_SSH_USER"); ok { if _, ok := os.LookupEnv("LOCAL_SSH_KEY"); ok { testContext.Provider = "local" break } } if dryRun { break } fallthrough ...
main
file
openshift/openshift-tests-private
361803f0-1a80-46ae-a497-df1e98ef358e
csi
import ( "fmt" "os" "path/filepath" "strings" "github.com/openshift/openshift-tests-private/test/extended/csi" "k8s.io/kubernetes/test/e2e/framework/testfiles" "k8s.io/kubernetes/test/e2e/storage/external" )
github.com/openshift/openshift-tests-private/cmd/extended-platform-tests/csi.go
package main import ( "fmt" "os" "path/filepath" "strings" "github.com/openshift/openshift-tests-private/test/extended/csi" "k8s.io/kubernetes/test/e2e/framework/testfiles" "k8s.io/kubernetes/test/e2e/storage/external" ) const ( manifestEnvVar = "TEST_CSI_DRIVER_FILES" installDriversEnvVar = "TEST_IN...
package main
function
openshift/openshift-tests-private
f6384396-741d-4178-9b31-f12d4f97a223
initCSITests
['"fmt"', '"os"', '"path/filepath"', '"strings"', '"github.com/openshift/openshift-tests-private/test/extended/csi"', '"k8s.io/kubernetes/test/e2e/framework/testfiles"', '"k8s.io/kubernetes/test/e2e/storage/external"']
github.com/openshift/openshift-tests-private/cmd/extended-platform-tests/csi.go
func initCSITests(dryRun bool) error { driverList := os.Getenv(installDriversEnvVar) if driverList != "" { drivers := strings.Split(driverList, ",") for _, driver := range drivers { manifestFile, err := csi.InstallCSIDriver(driver, dryRun) if err != nil { return fmt.Errorf("failed to install CSI driver ...
main
test
openshift/openshift-tests-private
32469bb5-bb75-4185-b459-4a2e97883cb6
api
import ( "context" "fmt" "os" "strings" "sync" "time" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/kubernetes" clientcorev1 "k8s.io/client-go/kubernetes/typ...
github.com/openshift/openshift-tests-private/pkg/monitor/api.go
package monitor import ( "context" "fmt" "os" "strings" "sync" "time" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/kubernetes" clientcorev1 "k8s.io/client-...
package monitor
function
openshift/openshift-tests-private
ffe9c8c5-23f9-4846-adeb-fc39fa5d0a6e
Start
['"context"', '"fmt"', '"os"', '"k8s.io/client-go/kubernetes"', '"k8s.io/client-go/tools/clientcmd"']
github.com/openshift/openshift-tests-private/pkg/monitor/api.go
func Start(ctx context.Context) (*Monitor, error) { m := NewMonitor() cfg := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(clientcmd.NewDefaultClientConfigLoadingRules(), &clientcmd.ConfigOverrides{}) clusterConfig, err := cfg.ClientConfig() if err != nil { return nil, fmt.Errorf("could not load client c...
monitor
function
openshift/openshift-tests-private
6ff63200-2fb6-4983-8ec1-bd4437f6f05c
startAPIMonitoring
['"context"', '"fmt"', '"time"', '"k8s.io/apimachinery/pkg/api/errors"', '"k8s.io/client-go/rest"']
github.com/openshift/openshift-tests-private/pkg/monitor/api.go
func startAPIMonitoring(ctx context.Context, m *Monitor, clusterConfig *rest.Config) error { pollingConfig := *clusterConfig pollingConfig.Timeout = 3 * time.Second pollingClient, err := clientcorev1.NewForConfig(&pollingConfig) if err != nil { return err } openshiftPollingClient, err := clientimagev1.NewForCon...
monitor
function
openshift/openshift-tests-private
3e53d6d6-1722-4942-b85f-f541ca4233d8
findContainerStatus
github.com/openshift/openshift-tests-private/pkg/monitor/api.go
func findContainerStatus(status []corev1.ContainerStatus, name string, position int) *corev1.ContainerStatus { if position < len(status) { if status[position].Name == name { return &status[position] } } for i := range status { if status[i].Name == name { return &status[i] } } return nil }
monitor
function
openshift/openshift-tests-private
a05364e3-bb5c-4c1a-86d4-5e466f5fa542
findNodeCondition
github.com/openshift/openshift-tests-private/pkg/monitor/api.go
func findNodeCondition(status []corev1.NodeCondition, name corev1.NodeConditionType, position int) *corev1.NodeCondition { if position < len(status) { if status[position].Type == name { return &status[position] } } for i := range status { if status[i].Type == name { return &status[i] } } return nil }
monitor
function
openshift/openshift-tests-private
c029f73a-b535-4aa8-82b1-fe526f89c0df
locateEvent
['"fmt"', '"strings"']
github.com/openshift/openshift-tests-private/pkg/monitor/api.go
func locateEvent(event *corev1.Event) string { if len(event.InvolvedObject.Namespace) > 0 { return fmt.Sprintf("ns/%s %s/%s", event.InvolvedObject.Namespace, strings.ToLower(event.InvolvedObject.Kind), event.InvolvedObject.Name) } return fmt.Sprintf("%s/%s", strings.ToLower(event.InvolvedObject.Kind), event.Involv...
monitor
function
openshift/openshift-tests-private
98f74dd4-f710-45d2-9016-58c15163a045
locatePod
['"fmt"']
github.com/openshift/openshift-tests-private/pkg/monitor/api.go
func locatePod(pod *corev1.Pod) string { return fmt.Sprintf("ns/%s pod/%s node/%s", pod.Namespace, pod.Name, pod.Spec.NodeName) }
monitor
function
openshift/openshift-tests-private
9f6a5ed3-8a5c-412e-8783-19c8673c5ece
locateNode
['"fmt"']
github.com/openshift/openshift-tests-private/pkg/monitor/api.go
func locateNode(node *corev1.Node) string { return fmt.Sprintf("node/%s", node.Name) }
monitor
function
openshift/openshift-tests-private
ab45e047-da7b-40e1-b195-34462c2c1b13
locatePodContainer
['"fmt"']
github.com/openshift/openshift-tests-private/pkg/monitor/api.go
func locatePodContainer(pod *corev1.Pod, containerName string) string { return fmt.Sprintf("ns/%s pod/%s node/%s container=%s", pod.Namespace, pod.Name, pod.Spec.NodeName, containerName) }
monitor
function
openshift/openshift-tests-private
df0236cc-a7f1-4e6d-9f43-902311b50aba
filterToSystemNamespaces
['"strings"', '"k8s.io/apimachinery/pkg/runtime"']
github.com/openshift/openshift-tests-private/pkg/monitor/api.go
func filterToSystemNamespaces(obj runtime.Object) bool { m, ok := obj.(metav1.Object) if !ok { return true } ns := m.GetNamespace() if len(ns) == 0 { return true } return strings.HasPrefix(ns, "kube-") || strings.HasPrefix(ns, "openshift-") || ns == "default" }
monitor
function
openshift/openshift-tests-private
93a4861e-ce97-4d06-ae6f-2fa043e98732
NewErrorRecordingListWatcher
['"k8s.io/client-go/tools/cache"']
['errorRecordingListWatcher']
github.com/openshift/openshift-tests-private/pkg/monitor/api.go
func NewErrorRecordingListWatcher(recorder Recorder, lw cache.ListerWatcher) cache.ListerWatcher { return &errorRecordingListWatcher{ lw: lw, recorder: recorder, } }
monitor
function
openshift/openshift-tests-private
bd886d5f-33d9-478d-918c-3f14e3fe53fe
List
['"k8s.io/apimachinery/pkg/runtime"']
['errorRecordingListWatcher']
github.com/openshift/openshift-tests-private/pkg/monitor/api.go
func (w *errorRecordingListWatcher) List(options metav1.ListOptions) (runtime.Object, error) { obj, err := w.lw.List(options) w.handle(err) return obj, err }
monitor
function
openshift/openshift-tests-private
8dc1b0e1-ba29-4281-a59e-555f98f0333f
Watch
['"k8s.io/apimachinery/pkg/watch"']
['errorRecordingListWatcher']
github.com/openshift/openshift-tests-private/pkg/monitor/api.go
func (w *errorRecordingListWatcher) Watch(options metav1.ListOptions) (watch.Interface, error) { obj, err := w.lw.Watch(options) w.handle(err) return obj, err }
monitor
function
openshift/openshift-tests-private
11015b77-f654-4a6e-b794-44c54e9b2938
handle
['"fmt"']
['errorRecordingListWatcher']
github.com/openshift/openshift-tests-private/pkg/monitor/api.go
func (w *errorRecordingListWatcher) handle(err error) { w.lock.Lock() defer w.lock.Unlock() if err != nil { if !w.receivedError { w.recorder.Record(Condition{ Level: Error, Locator: "kube-apiserver", Message: fmt.Sprintf("failed contacting the API: %v", err), }) } w.receivedError = true } ...
monitor
test
openshift/openshift-tests-private
cee823b1-3068-4aa3-94d3-45bf5e905612
cmd
import ( "context" "fmt" "io" "os" "os/signal" "syscall" "time" )
github.com/openshift/openshift-tests-private/pkg/monitor/cmd.go
package monitor import ( "context" "fmt" "io" "os" "os/signal" "syscall" "time" ) // Options is used to run a monitoring process against the provided server as // a command line interaction. type Options struct { Out, ErrOut io.Writer } // Run starts monitoring the cluster by invoking Start, periodically pri...
package monitor
function
openshift/openshift-tests-private
dcdd343f-b440-415f-a713-50f701ec8db9
Run
['"context"', '"fmt"', '"os"', '"os/signal"', '"syscall"', '"time"']
['Options']
github.com/openshift/openshift-tests-private/pkg/monitor/cmd.go
func (opt *Options) Run() error { ctx, cancelFn := context.WithCancel(context.Background()) defer cancelFn() abortCh := make(chan os.Signal) go func() { <-abortCh fmt.Fprintf(opt.ErrOut, "Interrupted, terminating\n") cancelFn() sig := <-abortCh fmt.Fprintf(opt.ErrOut, "Interrupted twice, exiting (%s)\n", ...
monitor
file
openshift/openshift-tests-private
70bba3b1-007f-48dd-9529-99b0487cca5d
event
import ( "context" "fmt" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/kubernetes" )
github.com/openshift/openshift-tests-private/pkg/monitor/event.go
package monitor import ( "context" "fmt" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/kubernetes" ) func startEventMonitoring(ctx context.Context, m Recorder, client kubernetes.Interface) { go ...
package monitor
function
openshift/openshift-tests-private
8d9cd4cb-3c58-4c2f-a55d-08550b99ca0b
startEventMonitoring
['"context"', '"fmt"', '"k8s.io/apimachinery/pkg/api/errors"', '"k8s.io/apimachinery/pkg/watch"', '"k8s.io/client-go/kubernetes"']
github.com/openshift/openshift-tests-private/pkg/monitor/event.go
func startEventMonitoring(ctx context.Context, m Recorder, client kubernetes.Interface) { go func() { for { select { case <-ctx.Done(): return default: } events, err := client.CoreV1().Events("").List(ctx, metav1.ListOptions{Limit: 1}) if err != nil { continue } rv := events.ResourceV...
monitor
file
openshift/openshift-tests-private
7dabc363-4513-48af-9dcb-4f18169b8f35
monitor
import ( "context" "fmt" "sort" "sync" "time" )
github.com/openshift/openshift-tests-private/pkg/monitor/monitor.go
package monitor import ( "context" "fmt" "sort" "sync" "time" ) // Monitor records events that have occurred in memory and can also periodically // sample results. type Monitor struct { interval time.Duration samplers []SamplerFunc lock sync.Mutex events []*Event samples []*sample } // NewMonitor crea...
package monitor
function
openshift/openshift-tests-private
e60db774-476b-4cd7-8a44-e3739c0791a5
NewMonitor
['"time"']
['Monitor']
github.com/openshift/openshift-tests-private/pkg/monitor/monitor.go
func NewMonitor() *Monitor { return &Monitor{ interval: 15 * time.Second, } }
monitor
function
openshift/openshift-tests-private
228decb6-f666-485c-bf73-a18a4767484e
StartSampling
['"context"', '"time"']
['Monitor']
github.com/openshift/openshift-tests-private/pkg/monitor/monitor.go
func (m *Monitor) StartSampling(ctx context.Context) { if m.interval == 0 { return } go func() { ticker := time.NewTicker(m.interval) defer ticker.Stop() for { select { case <-ticker.C: case <-ctx.Done(): m.sample() return } m.sample() } }() }
monitor
function
openshift/openshift-tests-private
e41b6f6a-2517-4f25-be54-9386d723236e
AddSampler
['Monitor']
github.com/openshift/openshift-tests-private/pkg/monitor/monitor.go
func (m *Monitor) AddSampler(fn SamplerFunc) { m.lock.Lock() defer m.lock.Unlock() m.samplers = append(m.samplers, fn) }
monitor
function
openshift/openshift-tests-private
cb0f648a-973b-41d4-9e33-846982c2c2a7
Record
['"time"']
['Monitor']
github.com/openshift/openshift-tests-private/pkg/monitor/monitor.go
func (m *Monitor) Record(conditions ...Condition) { if len(conditions) == 0 { return } m.lock.Lock() defer m.lock.Unlock() t := time.Now().UTC() for _, condition := range conditions { m.events = append(m.events, &Event{ At: t, Condition: condition, }) } }
monitor
function
openshift/openshift-tests-private
9fb22aaa-d66e-474f-af06-2f62ca90cff2
sample
['"time"']
['Monitor']
github.com/openshift/openshift-tests-private/pkg/monitor/monitor.go
func (m *Monitor) sample() { m.lock.Lock() samplers := m.samplers m.lock.Unlock() now := time.Now().UTC() var conditions []*Condition for _, fn := range samplers { conditions = append(conditions, fn(now)...) } if len(conditions) == 0 { return } m.lock.Lock() defer m.lock.Unlock() t := time.Now().UTC()...
monitor
function
openshift/openshift-tests-private
023ff638-661f-4665-b43e-104c9fed63bc
snapshot
['Monitor']
github.com/openshift/openshift-tests-private/pkg/monitor/monitor.go
func (m *Monitor) snapshot() ([]*sample, []*Event) { m.lock.Lock() defer m.lock.Unlock() return m.samples, m.events }
monitor
function
openshift/openshift-tests-private
21b8cc2f-62f1-4cdc-8fac-4b96719dbfba
Conditions
['"time"']
['Monitor']
github.com/openshift/openshift-tests-private/pkg/monitor/monitor.go
func (m *Monitor) Conditions(from, to time.Time) EventIntervals { samples, _ := m.snapshot() return filterSamples(samples, from, to) }
monitor
function
openshift/openshift-tests-private
daea46a3-4c2f-4a3e-bc59-47cba4960f9a
Events
['"fmt"', '"sort"', '"time"']
['Monitor']
github.com/openshift/openshift-tests-private/pkg/monitor/monitor.go
func (m *Monitor) Events(from, to time.Time) EventIntervals { samples, events := m.snapshot() intervals := filterSamples(samples, from, to) events = filterEvents(events, from, to) // merge the two sets of inputs mustSort := len(intervals) > 0 for i := range events { if i > 0 && events[i-1].At.After(events[i].A...
monitor
function
openshift/openshift-tests-private
afcdc96e-4619-4cdb-8e03-100f71aaf9f8
filterSamples
['"sort"', '"time"']
github.com/openshift/openshift-tests-private/pkg/monitor/monitor.go
func filterSamples(samples []*sample, from, to time.Time) EventIntervals { if len(samples) == 0 { return nil } if !from.IsZero() { first := sort.Search(len(samples), func(i int) bool { return samples[i].at.After(from) }) if first == -1 { return nil } samples = samples[first:] } if !to.IsZero() ...
monitor
function
openshift/openshift-tests-private
631ebaf7-9a10-4ede-b06d-525af31ddceb
filterEvents
['"sort"', '"time"']
github.com/openshift/openshift-tests-private/pkg/monitor/monitor.go
func filterEvents(events []*Event, from, to time.Time) []*Event { if from.IsZero() && to.IsZero() { return events } first := sort.Search(len(events), func(i int) bool { return events[i].At.After(from) }) if first == -1 { return nil } if to.IsZero() { return events[first:] } for i := first; i < len(eve...
monitor
file
openshift/openshift-tests-private
7ba43380-b369-4558-afed-42bd856f08a4
monitor_test
import ( "reflect" "testing" "time" "k8s.io/apimachinery/pkg/util/diff" )
github.com/openshift/openshift-tests-private/pkg/monitor/monitor_test.go
package monitor import ( "reflect" "testing" "time" "k8s.io/apimachinery/pkg/util/diff" ) func TestMonitor_Newlines(t *testing.T) { evt := &Event{Condition: Condition{Message: "a\nb\n"}} expected := "Jan 01 00:00:00.000 I a\\nb\\n" if evt.String() != expected { t.Fatalf("unexpected:\n%s\n%s", expected, evt...
package monitor
function
openshift/openshift-tests-private
f3279cfa-c779-4dee-be4f-19f45d090495
TestMonitor_Newlines
['"testing"']
github.com/openshift/openshift-tests-private/pkg/monitor/monitor_test.go
func TestMonitor_Newlines(t *testing.T) { evt := &Event{Condition: Condition{Message: "a\nb\n"}} expected := "Jan 01 00:00:00.000 I a\\nb\\n" if evt.String() != expected { t.Fatalf("unexpected:\n%s\n%s", expected, evt.String()) } }
monitor
function
openshift/openshift-tests-private
565ba134-0182-4b89-b041-1aa181bd264d
TestMonitor_Events
['"reflect"', '"testing"', '"time"', '"k8s.io/apimachinery/pkg/util/diff"']
github.com/openshift/openshift-tests-private/pkg/monitor/monitor_test.go
func TestMonitor_Events(t *testing.T) { tests := []struct { name string events []*Event samples []*sample from time.Time to time.Time want EventIntervals }{ { events: []*Event{ {Condition{Message: "1"}, time.Unix(1, 0)}, {Condition{Message: "2"}, time.Unix(2, 0)}, }, want...
monitor
file
openshift/openshift-tests-private
7df1c539-2aef-4874-b00c-d594d352bfc5
node
import ( "context" "fmt" "time" corev1 "k8s.io/api/core/v1" informercorev1 "k8s.io/client-go/informers/core/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/cache" )
github.com/openshift/openshift-tests-private/pkg/monitor/node.go
package monitor import ( "context" "fmt" "time" corev1 "k8s.io/api/core/v1" informercorev1 "k8s.io/client-go/informers/core/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/cache" ) func startNodeMonitoring(ctx context.Context, m Recorder, client kubernetes.Interface) { nodeChangeFns := []func(node,...
package monitor
function
openshift/openshift-tests-private
30eeb9e2-8d52-431b-a181-7ca47b07c9eb
startNodeMonitoring
['"context"', '"fmt"', '"time"', '"k8s.io/client-go/kubernetes"', '"k8s.io/client-go/tools/cache"']
github.com/openshift/openshift-tests-private/pkg/monitor/node.go
func startNodeMonitoring(ctx context.Context, m Recorder, client kubernetes.Interface) { nodeChangeFns := []func(node, oldNode *corev1.Node) []Condition{ func(node, oldNode *corev1.Node) []Condition { var conditions []Condition for i := range node.Status.Conditions { c := &node.Status.Conditions[i] pre...
monitor
file
openshift/openshift-tests-private
732e769e-3c7d-45ed-a573-bec4dca2b59d
operator
import ( "context" "fmt" "strings" "time" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/tools/cache" configv1 "github.com/openshift/api/config/v1" configclientset "github.com/openshift/client-go/config/clientset/versioned" )
github.com/openshift/openshift-tests-private/pkg/monitor/operator.go
package monitor import ( "context" "fmt" "strings" "time" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/tools/cache" configv1 "github.com/openshift/api/config/v1" configclientset "github.com/openshift/client-go/config/clien...
package monitor
function
openshift/openshift-tests-private
a28ba156-727f-42d1-8cad-a56c0bedc03e
startClusterOperatorMonitoring
['"context"', '"fmt"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/runtime"', '"k8s.io/apimachinery/pkg/watch"', '"k8s.io/client-go/tools/cache"']
github.com/openshift/openshift-tests-private/pkg/monitor/operator.go
func startClusterOperatorMonitoring(ctx context.Context, m Recorder, client configclientset.Interface) { coInformer := cache.NewSharedIndexInformer( NewErrorRecordingListWatcher(m, &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { return client.ConfigV1().ClusterOperators(...
monitor
function
openshift/openshift-tests-private
0fb55703-6766-4212-b098-5f4e608a1e34
locateClusterOperator
['"fmt"']
github.com/openshift/openshift-tests-private/pkg/monitor/operator.go
func locateClusterOperator(co *configv1.ClusterOperator) string { return fmt.Sprintf("clusteroperator/%s", co.Name) }
monitor
function
openshift/openshift-tests-private
d4b7709c-6979-4490-b860-e90acb2bb7c0
locateClusterVersion
['"fmt"']
github.com/openshift/openshift-tests-private/pkg/monitor/operator.go
func locateClusterVersion(cv *configv1.ClusterVersion) string { return fmt.Sprintf("clusterversion/%s", cv.Name) }
monitor
function
openshift/openshift-tests-private
2cfcf840-cf13-4cc5-8279-4cf8c7eeb95b
findOperatorVersionChange
['"fmt"']
github.com/openshift/openshift-tests-private/pkg/monitor/operator.go
func findOperatorVersionChange(old, new []configv1.OperandVersion) []string { var changed []string for i := 0; i < len(new); i++ { for j := 0; j < len(old); j++ { p := (j + i) % len(old) if old[p].Name != new[i].Name { continue } if old[p].Version == new[i].Version { break } changed = appe...
monitor
function
openshift/openshift-tests-private
26ac3974-9412-40eb-809b-114451b50633
findOperatorStatusCondition
github.com/openshift/openshift-tests-private/pkg/monitor/operator.go
func findOperatorStatusCondition(conditions []configv1.ClusterOperatorStatusCondition, conditionType configv1.ClusterStatusConditionType) *configv1.ClusterOperatorStatusCondition { for i := range conditions { if conditions[i].Type == conditionType { return &conditions[i] } } return nil }
monitor
file
openshift/openshift-tests-private
d2699363-a930-4560-8896-44c3b3cd3267
operator_test
import ( "reflect" "testing" configv1 "github.com/openshift/api/config/v1" )
github.com/openshift/openshift-tests-private/pkg/monitor/operator_test.go
package monitor import ( "reflect" "testing" configv1 "github.com/openshift/api/config/v1" ) func Test_findOperatorVersionChange(t *testing.T) { type args struct { } tests := []struct { name string old []configv1.OperandVersion new []configv1.OperandVersion want []string }{ { old: []configv1.Op...
package monitor
function
openshift/openshift-tests-private
c0bbc43f-430e-4f88-bae4-6e428259ff8d
Test_findOperatorVersionChange
['"reflect"', '"testing"']
github.com/openshift/openshift-tests-private/pkg/monitor/operator_test.go
func Test_findOperatorVersionChange(t *testing.T) { type args struct { } tests := []struct { name string old []configv1.OperandVersion new []configv1.OperandVersion want []string }{ { old: []configv1.OperandVersion{{Name: "a", Version: "1.0.0"}, {Name: "b", Version: "1.0.1"}}, new: []configv1.Oper...
monitor
file
openshift/openshift-tests-private
16fb6541-af49-44cb-9f3b-db30af1dc649
pod
import ( "context" "fmt" "time" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/cache" )
github.com/openshift/openshift-tests-private/pkg/monitor/pod.go
package monitor import ( "context" "fmt" "time" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/cache" ) func startPodMonitoring(ctx context.Context, m Recorder, ...
package monitor
function
openshift/openshift-tests-private
8c9acdbc-2bbd-4297-9c57-605b647d8afd
startPodMonitoring
['"context"', '"fmt"', '"time"', '"k8s.io/apimachinery/pkg/runtime"', '"k8s.io/apimachinery/pkg/watch"', '"k8s.io/client-go/kubernetes"', '"k8s.io/client-go/tools/cache"']
github.com/openshift/openshift-tests-private/pkg/monitor/pod.go
func startPodMonitoring(ctx context.Context, m Recorder, client kubernetes.Interface) { podInformer := cache.NewSharedIndexInformer( NewErrorRecordingListWatcher(m, &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { items, err := client.CoreV1().Pods("").List(ctx, options) ...
monitor
test
openshift/openshift-tests-private
9a5c60fb-f716-4dbc-9aba-37071eb8eafc
sampler
import ( "context" "sync" "time" )
github.com/openshift/openshift-tests-private/pkg/monitor/sampler.go
package monitor import ( "context" "sync" "time" ) type ConditionalSampler interface { ConditionWhenFailing(*Condition) SamplerFunc } type sampler struct { lock sync.Mutex available bool } func StartSampling(ctx context.Context, recorder Recorder, interval time.Duration, sampleFn func(previous bool) (*Co...
package monitor
function
openshift/openshift-tests-private
acee28ae-9618-4652-9918-0d62743a5e5c
StartSampling
['"context"', '"time"']
['sampler']
['ConditionalSampler']
github.com/openshift/openshift-tests-private/pkg/monitor/sampler.go
func StartSampling(ctx context.Context, recorder Recorder, interval time.Duration, sampleFn func(previous bool) (*Condition, bool)) ConditionalSampler { s := &sampler{ available: true, } go func() { ticker := time.NewTicker(interval) defer ticker.Stop() for { select { case <-ticker.C: case <-ctx.Do...
monitor
function
openshift/openshift-tests-private
8f9a5940-8118-4d51-84a4-db7a9ecd4b39
isAvailable
['sampler']
github.com/openshift/openshift-tests-private/pkg/monitor/sampler.go
func (s *sampler) isAvailable() bool { s.lock.Lock() defer s.lock.Unlock() return s.available }
monitor
function
openshift/openshift-tests-private
91565601-09e0-414d-a72d-120ea4549300
setAvailable
['sampler']
github.com/openshift/openshift-tests-private/pkg/monitor/sampler.go
func (s *sampler) setAvailable(b bool) { s.lock.Lock() defer s.lock.Unlock() s.available = b }
monitor
function
openshift/openshift-tests-private
eba5d7cc-c598-4ef8-a74d-777c1cbe29a9
ConditionWhenFailing
['"time"']
['sampler']
github.com/openshift/openshift-tests-private/pkg/monitor/sampler.go
func (s *sampler) ConditionWhenFailing(condition *Condition) SamplerFunc { return func(_ time.Time) []*Condition { if s.isAvailable() { return nil } return []*Condition{condition} } }
monitor
file
openshift/openshift-tests-private
7b2ae2f9-87b1-4c41-930f-228b6ce1c584
types
import ( "fmt" "sort" "strconv" "strings" "time" )
github.com/openshift/openshift-tests-private/pkg/monitor/types.go
package monitor import ( "fmt" "sort" "strconv" "strings" "time" ) type SamplerFunc func(time.Time) []*Condition type Interface interface { Events(from, to time.Time) EventIntervals Conditions(from, to time.Time) EventIntervals } type Recorder interface { Record(conditions ...Condition) AddSampler(fn Sampl...
package monitor
function
openshift/openshift-tests-private
a267679b-5289-461c-bc82-9f4b472d9733
String
['"fmt"', '"strings"']
['Event']
github.com/openshift/openshift-tests-private/pkg/monitor/types.go
func (e *Event) String() string { return fmt.Sprintf("%s.%03d %s %s %s", e.At.Format("Jan 02 15:04:05"), e.At.Nanosecond()/1000000, eventString[e.Level], e.Locator, strings.Replace(e.Message, "\n", "\\n", -1)) }
{'eventString': '[]string{\n\t"I",\n\t"W",\n\t"E",\n}'}
monitor
function
openshift/openshift-tests-private
7837a05e-b444-4596-9ab0-f8db8693fb1c
String
['"fmt"', '"strconv"', '"strings"', '"time"']
['EventInterval']
github.com/openshift/openshift-tests-private/pkg/monitor/types.go
func (i *EventInterval) String() string { if i.From.Equal(i.To) { return fmt.Sprintf("%s.%03d %s %s %s", i.From.Format("Jan 02 15:04:05"), i.From.Nanosecond()/int(time.Millisecond), eventString[i.Level], i.Locator, strings.Replace(i.Message, "\n", "\\n", -1)) } return fmt.Sprintf("%s.%03d - %-5s %s %s %s", i.From....
{'eventString': '[]string{\n\t"I",\n\t"W",\n\t"E",\n}'}
monitor
function
openshift/openshift-tests-private
100f1fc7-0ca1-4a95-bd56-9bd4550367fd
Less
github.com/openshift/openshift-tests-private/pkg/monitor/types.go
func (intervals EventIntervals) Less(i, j int) bool { switch d := intervals[i].From.Sub(intervals[j].From); { case d < 0: return true case d > 0: return false } switch d := intervals[i].To.Sub(intervals[j].To); { case d < 0: return true case d > 0: return false } return intervals[i].Message < intervals...
monitor
function
openshift/openshift-tests-private
1a6c6150-a297-4d09-98cf-ff57eb50b33f
Len
github.com/openshift/openshift-tests-private/pkg/monitor/types.go
func (intervals EventIntervals) Len() int { return len(intervals) }
monitor
function
openshift/openshift-tests-private
4ac5446c-c2bc-474d-86fc-61e1ab28d702
Swap
github.com/openshift/openshift-tests-private/pkg/monitor/types.go
func (intervals EventIntervals) Swap(i, j int) { intervals[i], intervals[j] = intervals[j], intervals[i] }
monitor
file
openshift/openshift-tests-private
91447f2d-876d-4abb-b878-390a0ad9495f
cmd_runsuite
import ( "bytes" "context" "fmt" "io" "io/ioutil" "os" "os/signal" "path/filepath" "sort" "strings" "syscall" "time" "github.com/openshift/openshift-tests-private/pkg/monitor" )
github.com/openshift/openshift-tests-private/pkg/test/ginkgo/cmd_runsuite.go
package ginkgo import ( "bytes" "context" "fmt" "io" "io/ioutil" "os" "os/signal" "path/filepath" "sort" "strings" "syscall" "time" "github.com/openshift/openshift-tests-private/pkg/monitor" ) // Options is used to run a suite of tests by invoking each test // as a call to a child worker (the run-tests ...
package ginkgo
function
openshift/openshift-tests-private
af5a5f22-d1ee-479a-80ec-27e7553769a2
AsEnv
['"fmt"']
['Options']
github.com/openshift/openshift-tests-private/pkg/test/ginkgo/cmd_runsuite.go
func (opt *Options) AsEnv() []string { var args []string args = append(args, fmt.Sprintf("TEST_PROVIDER=%s", opt.Provider)) args = append(args, fmt.Sprintf("TEST_SUITE_OPTIONS=%s", opt.SuiteOptions)) return args }
ginkgo
function
openshift/openshift-tests-private
8a594dd0-fd55-43cd-aa14-5e81d371b5ba
Run
['"bytes"', '"context"', '"fmt"', '"io/ioutil"', '"os"', '"os/signal"', '"path/filepath"', '"sort"', '"strings"', '"syscall"', '"time"', '"github.com/openshift/openshift-tests-private/pkg/monitor"']
['Options']
github.com/openshift/openshift-tests-private/pkg/test/ginkgo/cmd_runsuite.go
func (opt *Options) Run(args []string) error { var suite *TestSuite if len(opt.TestFile) > 0 { var in []byte var err error if opt.TestFile == "-" { in, err = ioutil.ReadAll(os.Stdin) if err != nil { return err } } else { in, err = ioutil.ReadFile(opt.TestFile) } if err != nil { return ...
ginkgo
file
openshift/openshift-tests-private
2b65620b-df41-4229-a2e7-4dc25a82887b
cmd_runtest
import ( "fmt" "io" "os" "regexp" "strings" "time" "github.com/onsi/ginkgo/v2" "github.com/onsi/ginkgo/v2/types" )
github.com/openshift/openshift-tests-private/pkg/test/ginkgo/cmd_runtest.go
package ginkgo import ( "fmt" "io" "os" "regexp" "strings" "time" "github.com/onsi/ginkgo/v2" "github.com/onsi/ginkgo/v2/types" ) type ExitError struct { Code int } func (e ExitError) Error() string { return fmt.Sprintf("exit with code %d", e.Code) } // TestOptions handles running a single test. type Tes...
package ginkgo
function
openshift/openshift-tests-private
88f00d12-cd84-4b4f-83d9-baa3dbbfba0c
Error
['"fmt"']
['ExitError']
github.com/openshift/openshift-tests-private/pkg/test/ginkgo/cmd_runtest.go
func (e ExitError) Error() string { return fmt.Sprintf("exit with code %d", e.Code) }
ginkgo
function
openshift/openshift-tests-private
f3eaef84-275c-46e4-8805-7b2466a38a90
Run
['"fmt"', '"os"', '"regexp"', '"time"', '"github.com/onsi/ginkgo/v2/types"']
['ExitError', 'TestOptions']
github.com/openshift/openshift-tests-private/pkg/test/ginkgo/cmd_runtest.go
func (opt *TestOptions) Run(args []string) error { if len(args) != 1 { return fmt.Errorf("only a single test name may be passed") } // Ignore the upstream suite behavior within test execution ginkgo.GetSuite().ClearBeforeAndAfterSuiteNodes() tests, err := testsForSuite() if err != nil { return err } var te...
ginkgo
function
openshift/openshift-tests-private
d8cc8fc4-f467-41ba-8874-c63bf6492254
Fail
['TestOptions']
github.com/openshift/openshift-tests-private/pkg/test/ginkgo/cmd_runtest.go
func (opt *TestOptions) Fail() { // this function allows us to pass TestOptions as the first argument, // it's empty becase we have failure check mechanism implemented above. }
ginkgo
function
openshift/openshift-tests-private
a40fcf6f-8272-4b45-a2f2-a1c29ea046bd
lastFilenameSegment
['"strings"']
github.com/openshift/openshift-tests-private/pkg/test/ginkgo/cmd_runtest.go
func lastFilenameSegment(filename string) string { if parts := strings.Split(filename, "/vendor/"); len(parts) > 1 { return parts[len(parts)-1] } if parts := strings.Split(filename, "/src/"); len(parts) > 1 { return parts[len(parts)-1] } return filename }
ginkgo
file
openshift/openshift-tests-private
93297e9a-96b8-4de7-b95f-8baec005104b
ginkgo
import ( "math/rand" "github.com/onsi/ginkgo/v2" "github.com/onsi/ginkgo/v2/types" "k8s.io/apimachinery/pkg/util/errors" )
github.com/openshift/openshift-tests-private/pkg/test/ginkgo/ginkgo.go
package ginkgo import ( "math/rand" "github.com/onsi/ginkgo/v2" "github.com/onsi/ginkgo/v2/types" "k8s.io/apimachinery/pkg/util/errors" ) func testsForSuite() ([]*testCase, error) { var tests []*testCase var errs []error // Avoid building the tree multiple times if !ginkgo.GetSuite().InPhaseBuildTree() { ...
package ginkgo
function
openshift/openshift-tests-private
5e2030be-12a9-47cf-b4b2-b43a9738af0d
testsForSuite
['"math/rand"', '"github.com/onsi/ginkgo/v2/types"', '"k8s.io/apimachinery/pkg/util/errors"']
github.com/openshift/openshift-tests-private/pkg/test/ginkgo/ginkgo.go
func testsForSuite() ([]*testCase, error) { var tests []*testCase var errs []error // Avoid building the tree multiple times if !ginkgo.GetSuite().InPhaseBuildTree() { _ = ginkgo.GetSuite().BuildTree() } ginkgo.GetSuite().WalkTests(func(name string, spec types.TestSpec) { // if append, ok := generated.Annot...
ginkgo
file
openshift/openshift-tests-private
e2944dfa-aa27-46ce-a73b-212ebf4a1d2f
junit
import ( "encoding/xml" "fmt" "io" "io/ioutil" "path/filepath" "strings" "time" )
github.com/openshift/openshift-tests-private/pkg/test/ginkgo/junit.go
package ginkgo import ( "encoding/xml" "fmt" "io" "io/ioutil" "path/filepath" "strings" "time" ) // The below types are directly marshalled into XML. The types correspond to jUnit // XML schema, but do not contain all valid fields. For instance, the class name // field for test cases is omitted, as this concep...
package ginkgo
function
openshift/openshift-tests-private
d2965b7a-4483-4907-bc95-f31e01a5b2a6
writeJUnitReport
['"encoding/xml"', '"fmt"', '"io"', '"io/ioutil"', '"path/filepath"', '"time"']
['JUnitTestSuite', 'JUnitTestCase', 'SkipMessage', 'FailureOutput']
github.com/openshift/openshift-tests-private/pkg/test/ginkgo/junit.go
func writeJUnitReport(filePrefix, name string, tests []*testCase, dir string, duration time.Duration, errOut io.Writer, additionalResults ...*JUnitTestCase) error { s := &JUnitTestSuite{ Name: name, Duration: duration.Seconds(), } for _, test := range tests { switch { case test.skipped: s.NumTests++ ...
ginkgo
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
3