<commit_before>package topgun_test

import (
	. "github.com/concourse/concourse/topgun/common"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
)

var _ = Describe("An ATC with default resource limits set", func() {
	BeforeEach(func() {
		Deploy(
			"deployments/concourse.yml",
			"-o", "operations/default_limits.yml",
			"-v", "default_task_cpu_limit=512",
			"-v", "default_task_memory_limit=1GB",
		)
	})

	It("respects the default resource limits, overridding when specified", func() {
		buildSession := Fly.Start("execute", "-c", "tasks/tiny.yml")
		<-buildSession.Exited

		hijackSession := Fly.Start(
			"hijack",
			"-b", "1",
			"--", "sh", "-c",
			"cat /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes; cat /sys/fs/cgroup/cpu/cpu.shares",
		)
		<-hijackSession.Exited

		Expect(hijackSession.ExitCode()).To(Equal(0))
		Expect(hijackSession).To(gbytes.Say("1073741824\n512"))

		buildSession = Fly.Start("execute", "-c", "tasks/limits.yml")
		<-buildSession.Exited

		hijackSession = Fly.Start(
			"hijack",
			"-b", "2",
			"--", "sh", "-c",
			"cat /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes; cat /sys/fs/cgroup/cpu/cpu.shares",
		)
		<-hijackSession.Exited

		Expect(hijackSession.ExitCode()).To(Equal(0))
		Expect(hijackSession).To(gbytes.Say("104857600\n256"))
	})
})<commit_msg>topgun: fix default_limits_test<commit_after>package topgun_test

import (
	. "github.com/concourse/concourse/topgun/common"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
)

var _ = Describe("An ATC with default resource limits set", func() {
	BeforeEach(func() {
		Deploy(
			"deployments/concourse.yml",
			"-o", "operations/default_limits.yml",
			"-v", "default_task_cpu_limit=512",
			"-v", "default_task_memory_limit=1GB",
		)
	})

	It("respects the default resource limits, overridding when specified", func() {
		buildSession := Fly.Start("execute", "-c", "tasks/tiny.yml")
		<-buildSession.Exited

		interceptSession := Fly.Start(
			"intercept",
			"-b", "1",
			"-s", "one-off",
			"--", "sh", "-c",
			"cat /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes; cat /sys/fs/cgroup/cpu/cpu.shares",
		)
		<-interceptSession.Exited

		Expect(interceptSession.ExitCode()).To(Equal(0))
		Expect(interceptSession).To(gbytes.Say("1073741824\n512"))

		buildSession = Fly.Start("execute", "-c", "tasks/limits.yml")
		<-buildSession.Exited

		interceptSession = Fly.Start(
			"intercept",
			"-b", "2",
			"-s", "one-off",
			"--", "sh", "-c",
			"cat /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes; cat /sys/fs/cgroup/cpu/cpu.shares",
		)
		<-interceptSession.Exited

		Expect(interceptSession.ExitCode()).To(Equal(0))
		Expect(interceptSession).To(gbytes.Say("104857600\n256"))
	})
})
{'fraction_non_alphanumeric': 0.194164265129683, 'fraction_numerical': 0.02377521613832853, 'mean_word_length': 4.095412844036697, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6186113', 'n_tokens_mistral': 1239, 'n_tokens_neox': 1070, 'n_words': 150}