<commit_before>#!/usr/bin/env bats

load ../helpers

function teardown() {
	swarm_manage_cleanup
	stop_docker
}

@test "docker run" {
	start_docker_with_busybox 2
	swarm_manage

	# make sure no container exist
	run docker_swarm ps -qa
	[ "${#lines[@]}" -eq 0 ]

	# run
	docker_swarm run -d --name test_container busybox sleep 100

	# verify, container is running
	[ -n $(docker_swarm ps -q --filter=name=test_container --filter=status=running) ]
}

@test "docker run not enough resources" {
	start_docker_with_busybox 1
	swarm_manage

	run docker_swarm run -d --name test_container -m 1000g busybox ls
	[ "$status" -ne 0 ]

	run docker_swarm run -d --name test_container -c 1000 busybox ls
	[ "$status" -ne 0 ]
}
<commit_msg>add -c test<commit_after>#!/usr/bin/env bats

load ../helpers

function teardown() {
	swarm_manage_cleanup
	stop_docker
}

@test "docker run" {
	start_docker_with_busybox 2
	swarm_manage

	# make sure no container exist
	run docker_swarm ps -qa
	[ "${#lines[@]}" -eq 0 ]

	# run
	docker_swarm run -d --name test_container busybox sleep 100

	# verify, container is running
	[ -n $(docker_swarm ps -q --filter=name=test_container --filter=status=running) ]
}

@test "docker run with resources" {
	start_docker_with_busybox 2
	swarm_manage

	# run
	docker_swarm run -d --name test_container -c 1 busybox sleep 100

	# verify, container is running
	[ -n $(docker_swarm ps -q --filter=name=test_container --filter=status=running) ]
}

@test "docker run not enough resources" {
	start_docker_with_busybox 1
	swarm_manage

	run docker_swarm run -d --name test_container -m 1000g busybox ls
	[ "$status" -ne 0 ]

	run docker_swarm run -d --name test_container -c 1000 busybox ls
	[ "$status" -ne 0 ]
}

{'fraction_non_alphanumeric': 0.10930232558139535, 'fraction_numerical': 0.021511627906976746, 'mean_word_length': 3.8072625698324023, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4713591', 'n_tokens_mistral': 705, 'n_tokens_neox': 616, 'n_words': 191}