How to use NewGoModCacheManager method of performance_test Package

Best Ginkgo code snippet using performance_test.NewGoModCacheManager

Run Ginkgo automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

compiling_and_running_test.go

Source: compiling_and_running_test.go Github

copy
1package performance_test
2
3import (
4	"fmt"
5
6	. "github.com/onsi/ginkgo/v2"
7	. "github.com/onsi/gomega"
8	"github.com/onsi/gomega/gmeasure"
9)
10
11var _ = Describe("Compiling and Running a single test package", func() {
12	var cache gmeasure.ExperimentCache
13
14	BeforeEach(func() {
15		var err error
16		cache, err = gmeasure.NewExperimentCache("./compiling-and-running-single-cache")
17		Ω(err).ShouldNot(HaveOccurred())
18
19		// we mount everything outside the Ginkgo parent directory to make sure GOMODULES doesn't get confused by the go.mod in Ginkgo's root
20		pfm = NewPerformanceFixtureManager(fmt.Sprintf("../../../ginkgo_perf_tmp_%d", GinkgoParallelProcess()))
21		gmcm = NewGoModCacheManager(fmt.Sprintf("../../../ginkgo_perf_cache_%d", GinkgoParallelProcess()))
22		if !DEBUG {
23			DeferCleanup(pfm.Cleanup)
24			DeferCleanup(gmcm.Cleanup)
25		}
26	})
27
28	Describe("Experiments", func() {
29		BeforeEach(func() {
30			pfm.MountFixture("performance")
31		})
32
33		It("runs a series of experiments with various scenarios", func() {
34			SampleScenarios(cache, 8, 1, true,
35				ScenarioSettings{Fixture: "performance", NumSuites: 1, ConcurrentCompilers: 1, ConcurrentRunners: 1},
36				ScenarioSettings{Fixture: "performance", NumSuites: 1, UseGoTestDirectly: true, ConcurrentGoTests: 1},
37				ScenarioSettings{Fixture: "performance", NumSuites: 1, UseGoTestDirectly: true, GoTestCompileThenRunSerially: true},
38			)
39		})
40	})
41
42	Describe("Analysis", func() {
43		It("analyzes the various scenarios to identify winners", func() {
44			AnalyzeCache(cache)
45		})
46	})
47})
48
49var _ = Describe("Compiling and Running multiple tests", func() {
50	var cache gmeasure.ExperimentCache
51
52	BeforeEach(func() {
53		var err error
54		cache, err = gmeasure.NewExperimentCache("./compiling-and-running-multiple-cache")
55		Ω(err).ShouldNot(HaveOccurred())
56
57		// we mount everything outside the Ginkgo parent directory to make sure GOMODULES doesn't get confused by the go.mod in Ginkgo's root
58		pfm = NewPerformanceFixtureManager(fmt.Sprintf("../../../ginkgo_perf_tmp_%d", GinkgoParallelProcess()))
59		gmcm = NewGoModCacheManager(fmt.Sprintf("../../../ginkgo_perf_cache_%d", GinkgoParallelProcess()))
60		if !DEBUG {
61			DeferCleanup(pfm.Cleanup)
62			DeferCleanup(gmcm.Cleanup)
63		}
64	})
65
66	Describe("Experiments", func() {
67		BeforeEach(func() {
68			pfm.MountFixture("performance")
69		})
70
71		It("runs a series of experiments with various scenarios", func() {
72			SampleScenarios(cache, 8, 1, true,
73				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 1, ConcurrentRunners: 1, Recurse: true},
74				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 2, ConcurrentRunners: 1, Recurse: true},
75				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 4, ConcurrentRunners: 1, Recurse: true},
76				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 2, ConcurrentRunners: 1, CompileFirstSuiteSerially: true, Recurse: true},
77				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 4, ConcurrentRunners: 1, CompileFirstSuiteSerially: true, Recurse: true},
78				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 2, ConcurrentRunners: 2, Recurse: true},
79				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 4, ConcurrentRunners: 2, Recurse: true},
80				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 2, ConcurrentRunners: 4, CompileFirstSuiteSerially: true, Recurse: true},
81				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 4, ConcurrentRunners: 4, CompileFirstSuiteSerially: true, Recurse: true},
82				ScenarioSettings{Fixture: "performance", NumSuites: 5, UseGoTestDirectly: true, ConcurrentGoTests: 1, Recurse: true},
83				ScenarioSettings{Fixture: "performance", NumSuites: 5, UseGoTestDirectly: true, ConcurrentGoTests: 2, Recurse: true},
84				ScenarioSettings{Fixture: "performance", NumSuites: 5, UseGoTestDirectly: true, ConcurrentGoTests: 4, Recurse: true},
85				ScenarioSettings{Fixture: "performance", NumSuites: 5, UseGoTestDirectly: true, ConcurrentGoTests: 8, Recurse: true},
86				ScenarioSettings{Fixture: "performance", NumSuites: 5, UseGoTestDirectly: true, GoTestCompileThenRunSerially: true, Recurse: true},
87				ScenarioSettings{Fixture: "performance", NumSuites: 5, UseGoTestDirectly: true, GoTestRecurse: true, Recurse: true},
88			)
89		})
90	})
91
92	Describe("Analysis", func() {
93		It("analyzes the various scenarios to identify winners", func() {
94			AnalyzeCache(cache)
95		})
96	})
97})
98
Full Screen

fetching_dependencies_test.go

Source: fetching_dependencies_test.go Github

copy
1package performance_test
2
3import (
4	"fmt"
5
6	. "github.com/onsi/ginkgo/v2"
7	. "github.com/onsi/gomega"
8	"github.com/onsi/gomega/gmeasure"
9)
10
11var _ = Describe("Fetching Dependencies", func() {
12	var cache gmeasure.ExperimentCache
13
14	BeforeEach(func() {
15		var err error
16		cache, err = gmeasure.NewExperimentCache("./fetching-dependencies-cache")
17		Ω(err).ShouldNot(HaveOccurred())
18
19		// we mount everything outside the Ginkgo parent directory to make sure GOMODULES doesn't get confused by the go.mod in Ginkgo's root
20		pfm = NewPerformanceFixtureManager(fmt.Sprintf("../../../ginkgo_perf_tmp_%d", GinkgoParallelProcess()))
21		gmcm = NewGoModCacheManager(fmt.Sprintf("../../../ginkgo_perf_cache_%d", GinkgoParallelProcess()))
22		if !DEBUG {
23			DeferCleanup(pfm.Cleanup)
24			DeferCleanup(gmcm.Cleanup)
25		}
26	})
27
28	Describe("Experiments", func() {
29		BeforeEach(func() {
30			pfm.MountFixture("performance")
31		})
32
33		It("runs a series of experiments with various scenarios", func() {
34			SampleScenarios(cache, 8, 1, false,
35				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 1, ConcurrentRunners: 1, Recurse: true, ClearGoModCache: true},
36				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 2, ConcurrentRunners: 1, Recurse: true, ClearGoModCache: true},
37				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 4, ConcurrentRunners: 1, Recurse: true, ClearGoModCache: true},
38				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 1, ConcurrentRunners: 1, GoModDownloadFirst: true, Recurse: true, ClearGoModCache: true},
39				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 2, ConcurrentRunners: 1, GoModDownloadFirst: true, Recurse: true, ClearGoModCache: true},
40				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 4, ConcurrentRunners: 1, GoModDownloadFirst: true, Recurse: true, ClearGoModCache: true},
41				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 2, ConcurrentRunners: 1, CompileFirstSuiteSerially: true, Recurse: true, ClearGoModCache: true},
42				ScenarioSettings{Fixture: "performance", NumSuites: 5, ConcurrentCompilers: 4, ConcurrentRunners: 1, CompileFirstSuiteSerially: true, Recurse: true, ClearGoModCache: true},
43			)
44		})
45	})
46
47	Describe("Analysis", func() {
48		It("analyzes the various fetching dependencies scenarios to identify winners", func() {
49			AnalyzeCache(cache)
50		})
51	})
52})
53
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Trigger NewGoModCacheManager code on LambdaTest Cloud Grid

Execute automation tests with NewGoModCacheManager on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)