Best Keploy code snippet using graph.TestRun
graph_test.go
Source:graph_test.go  
...42	if exp != got {43		t.Errorf(`expected "%s", got "%s"`, exp, got)44	}45}46func TestRuns(t *testing.T) {47	var got string48	g := graph.New()49	g.Add("a")50	g.Add("b")51	g.Add("c")52	g.Add("d")53	g.Add("e")54	g.Add("f")55	nodes := g.Nodes()56	if len(nodes) != 6 {57		t.Error("expected 6 nodes")58	}59	err := g.Evaluate()60	if err != nil {...testrun_controller.go
Source:testrun_controller.go  
...26	"k8s.io/apimachinery/pkg/api/resource"27	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"28)29var oneMibiByte = resource.MustParse("1Mi")30// TestRunReconciler reconciles a TestRun object31type TestRunReconciler struct {32	client.Client33	Scheme *runtime.Scheme34}35//+kubebuilder:rbac:groups=graphnode.streamingfast.io,resources=testruns,verbs=get;list;watch;create;update;patch;delete36//+kubebuilder:rbac:groups=graphnode.streamingfast.io,resources=testruns/status,verbs=get;update;patch37//+kubebuilder:rbac:groups=graphnode.streamingfast.io,resources=testruns/finalizers,verbs=update38var logger = log.Log.WithName("global")39// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile40func (r *TestRunReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {41	_ = log.FromContext(ctx)42	testRun := &graphnodev1alpha1.TestRun{}43	err := r.Get(ctx, req.NamespacedName, testRun)44	if err != nil {45		if apierrors.IsNotFound(err) {46			logger.V(0).Info("no testrun found")47			return ctrl.Result{}, nil48		}49		return ctrl.Result{}, err50	}51	logger.V(1).Info(fmt.Sprintf("Managing TestRun:%+v", testRun.Spec))52	if err := r.EnsurePVC(ctx, testRun); err != nil {53		logger.Error(err, "trying to ensurePVC")54		return ctrl.Result{}, err55	}56	if err := r.EnsureJob(ctx, testRun); err != nil {57		logger.Error(err, "trying to ensureJOB")58		return ctrl.Result{}, err59	}60	return ctrl.Result{}, nil61}62func deterministicPVCName(testRunName string) string {63	return fmt.Sprintf("sql-%s", testRunName)64}65func deterministicJobName(testRunName string) string {66	return fmt.Sprintf("job-%s", testRunName)67}68func (r *TestRunReconciler) EnsureJob(ctx context.Context, testRun *graphnodev1alpha1.TestRun) error {69	job := jobDef(testRun)70	controllerutil.SetControllerReference(testRun, job, r.Scheme) // force ownership71	err := r.Create(ctx, job)72	if err == nil {73		logger.Info("Created job", "namespace", job.Namespace, "name", job.Name)74	}75	if apierrors.IsAlreadyExists(err) { //FIXME check before ? what is optimal here ?76		return nil77	}78	return err79}80func (r *TestRunReconciler) EnsurePVC(ctx context.Context, testRun *graphnodev1alpha1.TestRun) error {81	pvcName := deterministicPVCName(testRun.Name)82	pvc := &corev1.PersistentVolumeClaim{83		ObjectMeta: metav1.ObjectMeta{84			Name:        pvcName,85			Namespace:   testRun.Namespace,86			Annotations: nil,87		},88		Spec: corev1.PersistentVolumeClaimSpec{89			AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce},90			Resources: corev1.ResourceRequirements{91				Requests: corev1.ResourceList{92					"storage": testRun.Spec.PGDataStorage,93				},94			},95			StorageClassName: &testRun.Spec.StorageClassName,96		},97	}98	controllerutil.SetControllerReference(testRun, pvc, r.Scheme) // force ownership99	err := r.Create(ctx, pvc)100	if err == nil {101		logger.Info("Created pvc", "namespace", pvc.Namespace, "name", pvc.Name)102	}103	if apierrors.IsAlreadyExists(err) { //FIXME check before ? what is optimal here ?104		return nil105	}106	return err107}108func jobDef(testRun *graphnodev1alpha1.TestRun) *batchv1.Job {109	//var tolerations []corev1.Toleration110	//var affinity corev1.Affinity111	//if batchConfig.NodePool != "" {112	//        tolerations = tolerationsForPool(batchConfig.NodePool)113	//        affinity = affinityForPool(batchConfig.NodePool)114	//}115	backoffLimit := int32(0)116	return &batchv1.Job{117		ObjectMeta: metav1.ObjectMeta{118			Name:        deterministicJobName(testRun.Name),119			Namespace:   testRun.Namespace,120			Annotations: map[string]string{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"}, // no eviction permitted121		},122		Spec: batchv1.JobSpec{123			BackoffLimit: &backoffLimit,124			Template: corev1.PodTemplateSpec{125				ObjectMeta: metav1.ObjectMeta{126					Annotations: map[string]string{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"}, // no eviction permitted127				},128				Spec: corev1.PodSpec{129					Containers: []corev1.Container{130						{131							Name:      "sql",132							Image:     testRun.Spec.PostgresTarballerDockerImage,133							Command:   []string{"/restorer.sh"},134							Resources: testRun.Spec.PostgresResources,135							Env: []corev1.EnvVar{136								{Name: "PGDATA", Value: "/data/db"},137								{Name: "POSTGRES_PASSWORD", Value: testRun.Spec.PostgresPassword},138								{Name: "POSTGRES_USER", Value: testRun.Spec.PostgresUser},139								{Name: "POSTGRES_DB", Value: testRun.Spec.PostgresDBName},140								{Name: "SRC_TARBALL_URL", Value: testRun.Spec.TarballsURL},141								{Name: "SIGNALING_FOLDER", Value: "/data/signal"},142								//"SRC_TARBALL_FILENAME" - latest alphabetically by default143							},144							VolumeMounts: []corev1.VolumeMount{145								{146									Name:      "dbdata",147									MountPath: "/data/db",148								},149								{150									Name:      "signal",151									MountPath: "/data/signal",152								},153								{154									Name:      "output",155									MountPath: "/data/output",156								},157							},158						},159						{160							Name:  "graph-node",161							Image: testRun.Spec.GraphnodeDockerImage,162							Command: []string{163								"sh",164								"-c",165								"git clone $GITREPO --branch $GITBRANCH --single-branch /data/graph-node && cd /data/graph-node;" +166									"cargo build -p graph-node;" +167									"echo Waiting for ${SIGNALING_FOLDER}/dbready...; while sleep 1; do test -e ${SIGNALING_FOLDER}/dbready && break; done;" +168									"(./target/debug/graph-node --ethereum-rpc=${ETHEREUM_RPC} --postgres-url=\"postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB}\" --ipfs=${IPFS_ADDR} 2>&1 | tee /data/output/full.log)& " +169									"while sleep 5; do grep -q 'stop block reached for subgraph' /data/output/full.log && pkill graph-node && break; done; " +170									"OUTPUT_TAG=$(date +%s)-$(git rev-parse --short HEAD);" +171									"echo \"cd /data/output && gsutil -m cp -r . ${OUTPUT_URL}/${OUTPUT_TAG}\" > /data/signal/complete.tmp && " + // the tarballer-postgresql will execute this command172									"chmod +x /data/signal/complete.tmp && mv /data/signal/complete.tmp /data/signal/complete",173							},174							Resources: testRun.Spec.GraphnodeResources,175							Env: []corev1.EnvVar{176								{Name: "GITREPO", Value: testRun.Spec.GitRepo},177								{Name: "GITBRANCH", Value: testRun.Spec.GitBranch},178								{Name: "ETHEREUM_RPC", Value: testRun.Spec.EthereumRPCAddress},179								{Name: "IPFS_ADDR", Value: testRun.Spec.IPFSAddr},180								{Name: "POSTGRES_PASSWORD", Value: testRun.Spec.PostgresPassword},181								{Name: "POSTGRES_USER", Value: testRun.Spec.PostgresUser},182								{Name: "POSTGRES_DB", Value: testRun.Spec.PostgresDBName},183								{Name: "GRAPH_STOP_BLOCK", Value: fmt.Sprintf("%d", testRun.Spec.StopBlock)},184								{Name: "SIGNALING_FOLDER", Value: "/data/signal"},185								{Name: "GRAPH_DEBUG_POI_FILE", Value: "/data/output/poi.csv"},186								{Name: "OUTPUT_URL", Value: testRun.Spec.TestOutputURL},187							},188							VolumeMounts: []corev1.VolumeMount{189								{190									Name:      "signal",191									MountPath: "/data/signal",192								},193								{194									Name:      "output",195									MountPath: "/data/output",196								},197							},198						},199					},200					Volumes: []corev1.Volume{201						{202							Name:         "dbdata",203							VolumeSource: corev1.VolumeSource{PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{ClaimName: deterministicPVCName(testRun.Name)}},204						},205						{206							Name:         "signal",207							VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{SizeLimit: &oneMibiByte}},208						},209						{210							Name:         "output",211							VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{SizeLimit: &testRun.Spec.OutputDirSize}},212						},213					},214					RestartPolicy:      corev1.RestartPolicyNever,215					ServiceAccountName: testRun.Spec.ServiceAccountName,216					//                                       Tolerations:        tolerations,217					//                                       Affinity:           &affinity,218				},219			},220		},221	}222}223// SetupWithManager sets up the controller with the Manager.224func (r *TestRunReconciler) SetupWithManager(mgr ctrl.Manager) error {225	return ctrl.NewControllerManagedBy(mgr).226		For(&graphnodev1alpha1.TestRun{}).227		Complete(r)228}...testrun_types.go
Source:testrun_types.go  
...16	"k8s.io/apimachinery/pkg/api/resource"17	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"18)19// NOTE: json tags are required.  Any new fields you add must have json tags for the fields to be serialized.20// TestRunSpec defines the desired state of TestRun21type TestRunSpec struct {22	GitBranch          string `json:"git_branch"`           //ex: master23	GitRepo            string `json:"git_repo"`             //ex: https://github.com/graph-protocol/graph-node24	StopBlock          uint64 `json:"stop_block"`           //ex: 12345625	IPFSAddr           string `json:"ipfs_addr"`            // ex: ipfs-v3.mydomain.com26	EthereumRPCAddress string `json:"ethereum_rpc_address"` // ex: mainnet:https://something/someKey27	GraphnodeDockerImage string `json:"graphnode_docker_image"` // ex: rust:1.5228	StorageClassName     string `json:"storage_class_name"`     // ex: standard29	ServiceAccountName   string `json:"service_account_name"`   // ex: some-data-reader30	TarballsURL          string `json:"tarballs_url"`           // ex: gs://mybucket/tarballs31	TestOutputURL        string `json:"output_url"`             // ex: gs://mybucket/tests_results32	PostgresTarballerDockerImage string `json:"postgres_tarballer_docker_image"` // ex: dfuse/tarballer:0.0.633	PostgresDBName               string `json:"postgres_db_name"`                // ex: graph34	PostgresUser                 string `json:"postgres_user"`                   // ex: graph35	PostgresPassword             string `json:"postgres_password"`               // ex: changeme36	PGDataStorage resource.Quantity `json:"pgdata_storage"`  // ex: "20Gi"37	OutputDirSize resource.Quantity `json:"output_dir_size"` // ex: "1Gi"38	PostgresResources  corev1.ResourceRequirements `json:"postgres_resources"`  // ex: {"limit": {"memory":"10Gi", cpu: "2"  }, "request": {...}}39	GraphnodeResources corev1.ResourceRequirements `json:"graphnode_resources"` // see above40}41// TestRunStatus defines the observed state of TestRun42type TestRunStatus struct {43	// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster44	// Important: Run "make" to regenerate code after modifying this file45}46//+kubebuilder:object:root=true47//+kubebuilder:subresource:status48// TestRun is the Schema for the testruns API49type TestRun struct {50	metav1.TypeMeta   `json:",inline"`51	metav1.ObjectMeta `json:"metadata,omitempty"`52	Spec   TestRunSpec   `json:"spec,omitempty"`53	Status TestRunStatus `json:"status,omitempty"`54}55//+kubebuilder:object:root=true56// TestRunList contains a list of TestRun57type TestRunList struct {58	metav1.TypeMeta `json:",inline"`59	metav1.ListMeta `json:"metadata,omitempty"`60	Items           []TestRun `json:"items"`61}62func init() {63	SchemeBuilder.Register(&TestRun{}, &TestRunList{})64}...TestRun
Using AI Code Generation
1func main() {2    g := graph.NewGraph()3    g.AddNode("A")4    g.AddNode("B")5    g.AddNode("C")6    g.AddNode("D")7    g.AddNode("E")8    g.AddNode("F")9    g.AddNode("G")10    g.AddNode("H")11    g.AddNode("I")12    g.AddNode("J")13    g.AddNode("K")14    g.AddNode("L")15    g.AddNode("M")16    g.AddNode("N")17    g.AddNode("O")18    g.AddNode("P")19    g.AddNode("Q")20    g.AddNode("R")21    g.AddNode("S")22    g.AddNode("T")23    g.AddNode("U")24    g.AddNode("V")25    g.AddNode("W")26    g.AddNode("X")27    g.AddNode("Y")28    g.AddNode("Z")29    g.AddEdge("A", "B", 1)30    g.AddEdge("A", "C", 1)31    g.AddEdge("B", "D", 1)32    g.AddEdge("B", "E", 1)33    g.AddEdge("C", "F", 1)34    g.AddEdge("C", "G", 1)35    g.AddEdge("D", "H", 1)36    g.AddEdge("D", "I", 1)37    g.AddEdge("E", "J", 1)38    g.AddEdge("E", "K", 1)39    g.AddEdge("F", "L", 1)40    g.AddEdge("F", "M", 1)41    g.AddEdge("G", "N", 1)42    g.AddEdge("G", "O", 1)43    g.AddEdge("H", "P", 1)44    g.AddEdge("H", "Q", 1)45    g.AddEdge("I", "R", 1)46    g.AddEdge("I", "S", 1)47    g.AddEdge("J", "T", 1)48    g.AddEdge("J", "U", 1)49    g.AddEdge("K", "V", 1)50    g.AddEdge("K", "W", 1)51    g.AddEdge("L", "X", 1)52    g.AddEdge("LTestRun
Using AI Code Generation
1import (2func main() {3	g := graph.NewGraph(6)4	g.AddEdge(0, 1)5	g.AddEdge(0, 2)6	g.AddEdge(1, 3)7	g.AddEdge(2, 3)8	g.AddEdge(2, 4)9	g.AddEdge(3, 5)10	g.AddEdge(4, 5)11	g.TestRun()12}13import (14func main() {15	g := graph.NewGraph(6)16	g.AddEdge(0, 1)17	g.AddEdge(0, 2)18	g.AddEdge(1, 3)19	g.AddEdge(2, 3)20	g.AddEdge(2, 4)21	g.AddEdge(3, 5)22	g.AddEdge(4, 5)23	g.TestRun()24}25import (26type Graph struct {27}28func NewGraph(vertices int) *Graph {29	g := &Graph{}30	g.adjacencyList = make(map[int][]int, vertices)31}32func (g *Graph) AddEdge(source, destination int) {33	g.adjacencyList[source] = append(g.adjacencyList[source], destination)34	g.adjacencyList[destination] = append(g.adjacencyList[destination], source)35}36func (g *Graph) TestRun() {37	for key, value := range g.adjacencyList {38		fmt.Printf("%v: %v39	}40}TestRun
Using AI Code Generation
1import (2func main() {3	g := graph.NewGraph(5)4	g.AddEdge(0, 1)5	g.AddEdge(0, 2)6	g.AddEdge(1, 2)7	g.AddEdge(2, 0)8	g.AddEdge(2, 3)9	g.AddEdge(3, 3)10	g.AddEdge(4, 4)11	g.AddEdge(1, 4)12	g.AddEdge(4, 3)13	g.AddEdge(3, 1)14	fmt.Println("Depth First Traversal starting from vertex 2")15	g.TestRun(2)16	fmt.Println("Breadth First Traversal starting from vertex 2")17	g.TestRunBFS(2)18}19import (20type Graph struct {21}22func NewGraph(v int) *Graph {23	g := &Graph{v: v}24	g.adjList = make([]*list.List, v)25	for i := 0; i < v; i++ {26		g.adjList[i] = list.New()27	}28}29func (g *Graph) AddEdge(src, dest int) {30	g.adjList[src].PushBack(dest)31}32func (g *Graph) TestRun(start int) {33	visited := make([]bool, g.v)34	g.Run(start, visited)35}36func (g *Graph) Run(start int, visited []bool) {37	fmt.Printf("%d ", start)38	for e := g.adjList[start].Front(); e != nil; e = e.Next() {39		if !visited[e.Value.(int)] {40			g.Run(e.Value.(int), visited)41		}42	}43}44func (g *Graph) TestRunBFS(start int) {45	visited := make([]bool, g.v)46	g.RunBFS(start, visited)47}48func (g *Graph) RunBFS(start int, visited []bool) {49	queue := list.New()50	queue.PushBack(start)51	for queue.Len() != 0 {52		s := queue.Front()53		queue.Remove(s)54		fmt.Printf("%d ", s.Value.(int))55		for e := g.adjList[s.Value.(int)].Front(); e != nil; eTestRun
Using AI Code Generation
1import (2func main() {3	g.AddEdge(1, 2)4	g.AddEdge(1, 3)5	g.AddEdge(2, 3)6	g.AddEdge(3, 4)7	g.AddEdge(4, 5)8	g.AddEdge(4, 6)9	g.AddEdge(5, 6)10	g.AddEdge(6, 7)11	g.AddEdge(7, 8)12	g.AddEdge(7, 9)13	g.AddEdge(8, 9)14	g.AddEdge(9, 10)15	g.AddEdge(10, 11)16	g.AddEdge(11, 12)17	g.AddEdge(11, 13)18	g.AddEdge(11, 14)19	g.AddEdge(12, 13)20	g.AddEdge(13, 14)21	g.AddEdge(14, 15)22	g.AddEdge(15, 16)23	g.AddEdge(16, 17)24	g.AddEdge(16, 18)25	g.AddEdge(17, 18)26	g.AddEdge(18, 19)27	g.AddEdge(19, 20)28	g.AddEdge(20, 21)29	g.AddEdge(21, 22)30	g.AddEdge(22, 23)31	g.AddEdge(23, 24)32	g.AddEdge(24, 25)33	g.AddEdge(25, 26)34	g.AddEdge(26, 27)35	g.AddEdge(27, 28)36	g.AddEdge(28, 29)37	g.AddEdge(29, 30)38	g.AddEdge(30, 31)39	g.AddEdge(31, 32)40	g.AddEdge(32, 33)41	g.AddEdge(33, 34)42	g.AddEdge(34, 35)43	g.AddEdge(35, 36)44	g.AddEdge(36, 37)45	g.AddEdge(37, 38)46	g.AddEdge(38, 39)47	g.AddEdge(39, 40)48	g.AddEdge(40, 41)49	g.AddEdge(41, 42)50	g.AddEdge(42, 43)51	g.AddEdge(43, 44)52	g.AddEdge(44, 45)53	g.AddEdge(45, 46)54	g.AddEdge(46, 47)55	g.AddEdge(47, 48TestRun
Using AI Code Generation
1import (2func main() {3    g := graph.New(6)4    g.AddEdge(0, 1, 1)5    g.AddEdge(0, 2, 1)6    g.AddEdge(1, 3, 1)7    g.AddEdge(1, 4, 1)8    g.AddEdge(2, 5, 1)9    g.AddEdge(3, 4, 1)10    g.AddEdge(4, 5, 1)11    g.AddEdge(5, 3, 1)12    g.AddEdge(5, 0, 1)13    g.AddEdge(0, 5, 1)14    g.AddEdge(1, 2, 1)15    g.AddEdge(2, 3, 1)16    g.AddEdge(3, 5, 1)17    g.AddEdge(5, 4, 1)18    g.AddEdge(4, 0, 1)19    g.AddEdge(0, 3, 1)20    g.AddEdge(3, 2, 1)21    g.AddEdge(2, 4, 1)22    g.AddEdge(4, 1, 1)23    g.AddEdge(1, 0, 1)24    g.AddEdge(0, 4, 1)25    g.AddEdge(4, 3, 1)26    g.AddEdge(3, 1, 1)27    g.AddEdge(1, 5, 1)28    g.AddEdge(5, 2, 1)29    g.AddEdge(2, 0, 1)30    g.AddEdge(0, 2, 1)31    g.AddEdge(2, 1, 1)32    g.AddEdge(1, 4, 1)33    g.AddEdge(4, 5, 1)34    g.AddEdge(5, 0, 1)35    g.AddEdge(0, 3, 1)36    g.AddEdge(3, 4, 1)37    g.AddEdge(4, 2, 1)38    g.AddEdge(2, 5, 1)39    g.AddEdge(5, 1, 1TestRun
Using AI Code Generation
1import (2func main() {3    g.Add(1, 2, 3, 4, 5, 6, 7, 8)4    g.AddArc(1, 2)5    g.AddArc(1, 3)6    g.AddArc(2, 4)7    g.AddArc(2, 5)8    g.AddArc(3, 6)9    g.AddArc(3, 7)10    g.AddArc(4, 8)11    g.AddArc(5, 8)12    g.AddArc(6, 8)13    g.AddArc(7, 8)14    g.AddArc(8, 1)15    g.AddArc(8, 2)16    g.AddArc(8, 3)17    g.AddArc(8, 4)18    g.AddArc(8, 5)19    g.AddArc(8, 6)20    g.AddArc(8, 7)21    fmt.Println(g.TestRun(1, 8))22    fmt.Println(g.TestRun(1, 2))23    fmt.Println(g.TestRun(8, 1))24    fmt.Println(g.TestRun(8, 8))25}TestRun
Using AI Code Generation
1func main() {2    g := graph.NewGraph()3    n1 := graph.NewNode("n1")4    n2 := graph.NewNode("n2")5    n3 := graph.NewNode("n3")6    n4 := graph.NewNode("n4")7    n5 := graph.NewNode("n5")8    n6 := graph.NewNode("n6")9    n7 := graph.NewNode("n7")10    n8 := graph.NewNode("n8")11    n9 := graph.NewNode("n9")12    n10 := graph.NewNode("n10")13    n11 := graph.NewNode("n11")14    n12 := graph.NewNode("n12")15    n13 := graph.NewNode("n13")16    n14 := graph.NewNode("n14")17    n15 := graph.NewNode("n15")18    n16 := graph.NewNode("n16")19    n17 := graph.NewNode("n17")20    n18 := graph.NewNode("n18")21    n19 := graph.NewNode("n19")22    n20 := graph.NewNode("n20")23    n21 := graph.NewNode("n21")24    n22 := graph.NewNode("n22")25    n23 := graph.NewNode("n23")26    n24 := graph.NewNode("n24")27    n25 := graph.NewNode("n25")28    n26 := graph.NewNode("n26")29    n27 := graph.NewNode("n27")30    n28 := graph.NewNode("n28")31    n29 := graph.NewNode("n29")32    n30 := graph.NewNode("n30")33    n31 := graph.NewNode("n31")34    n32 := graph.NewNode("n32")35    n33 := graph.NewNode("n33")36    n34 := graph.NewNode("n34")37    n35 := graph.NewNode("n35")38    n36 := graph.NewNode("n36")39    n37 := graph.NewNode("n37")40    n38 := graph.NewNode("n38")41    n39 := graph.NewNode("n39")42    n40 := graph.NewNode("n40")43    n41 := graph.NewNode("n41")44    n42 := graph.NewNode("n42")45    n43 := graph.NewNode("n43")TestRun
Using AI Code Generation
1import (2func main() {3    reader := bufio.NewReader(os.Stdin)4    fmt.Println("Enter the number of nodes in the graph")5    text, _ := reader.ReadString('6    fmt.Println(text)7    fmt.Println("Enter the number of edges in the graph")8    text, _ = reader.ReadString('9    fmt.Println(text)10    fmt.Println("Enter the edges in the graph")11    text, _ = reader.ReadString('12    fmt.Println(text)13    fmt.Println("Enter the starting node")14    text, _ = reader.ReadString('15    fmt.Println(text)16    fmt.Println("Enter the ending node")17    text, _ = reader.ReadString('18    fmt.Println(text)19}20import (21func main() {22    reader := bufio.NewReader(os.Stdin)23    fmt.Println("Enter the number of nodes in the graph")24    text, _ := reader.ReadString('25    fmt.Println(text)26    fmt.Println("Enter the number of edges in the graph")27    text, _ = reader.ReadString('28    fmt.Println(text)29    fmt.Println("Enter the edges in the graph")30    text, _ = reader.ReadString('31    fmt.Println(text)32    fmt.Println("Enter the starting node")33    text, _ = reader.ReadString('34    fmt.Println(text)35    fmt.Println("Enter the ending node")36    text, _ = reader.ReadString('37    fmt.Println(text)38}39import (40func main() {41    reader := bufio.NewReader(os.Stdin)42    fmt.Println("Enter the number of nodes in the graph")43    text, _ := reader.ReadString('44    fmt.Println(text)45    fmt.Println("Enter the number of edges in the graph")46    text, _ = reader.ReadString('47    fmt.Println(text)48    fmt.Println("Enter the edges in the graph")49    text, _ = reader.ReadString('50    fmt.Println(text)51    fmt.Println("Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
