<commit_before>package executor

import (
	. "github.com/smartystreets/goconvey/convey"
	"testing"
	log "github.com/Sirupsen/logrus"
)

const (
	fifoTestDirTemplate = "/tmp/swan_local_test.XXXXXXXXXXX"
	fifoTestName        = "swan_fifo"
)

// TestLocal
func TestLocal(t *testing.T) {
	log.SetLevel(log.ErrorLevel)

	Convey("While using Local Shell", t, func() {
		l := NewLocal()

		Convey("When blocking infinitive sleep command " +
			"is executed", func() {
			task, err := l.Execute("sleep inf")

			Convey("There should be no error", func() {
				So(err, ShouldBeNil)

				task.Stop()
			})

			Convey("Task should be still running and status should be nil", func() {
				taskState, taskStatus := task.Status()
				So(taskState, ShouldEqual, RUNNING)
				So(taskStatus, ShouldBeNil)

				task.Stop()
			})

			Convey("When we wait for task with the 1ms timeout", func() {
				taskNotTimeouted := task.Wait(1)

				Convey("The timeout should exceed ", func() {
					So(taskNotTimeouted, ShouldBeFalse)
				})

				Convey("The task should be still running and status should be nil", func() {
					taskState, taskStatus := task.Status()
					So(taskState, ShouldEqual, RUNNING)
					So(taskStatus, ShouldBeNil)
				})<commit_msg>Performed fmt.<commit_after>package executor

import (
	log "github.com/Sirupsen/logrus"
	. "github.com/smartystreets/goconvey/convey"
	"testing"
)

const (
	fifoTestDirTemplate = "/tmp/swan_local_test.XXXXXXXXXXX"
	fifoTestName        = "swan_fifo"
)

// TestLocal
func TestLocal(t *testing.T) {
	log.SetLevel(log.ErrorLevel)

	Convey("While using Local Shell", t, func() {
		l := NewLocal()

		Convey("When blocking infinitive sleep command "+
			"is executed", func() {
			task, err := l.Execute("sleep inf")

			Convey("There should be no error", func() {
				So(err, ShouldBeNil)

				task.Stop()
			})

			Convey("Task should be still running and status should be nil", func() {
				taskState, taskStatus := task.Status()
				So(taskState, ShouldEqual, RUNNING)
				So(taskStatus, ShouldBeNil)

				task.Stop()
			})

			Convey("When we wait for task with the 1ms timeout", func() {
				taskNotTimeouted := task.Wait(1)

				Convey("The timeout should exceed ", func() {
					So(taskNotTimeouted, ShouldBeFalse)
				})

				Convey("The task should be still running and status should be nil", func() {
					taskState, taskStatus := task.Status()
					So(taskState, ShouldEqual, RUNNING)
					So(taskStatus, ShouldBeNil)
				})
{'fraction_non_alphanumeric': 0.127944760357433, 'fraction_numerical': 0.0016246953696181965, 'mean_word_length': 3.561111111111111, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '893596', 'n_tokens_mistral': 966, 'n_tokens_neox': 811, 'n_words': 211}