source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/commands/container/limits_and_devices_spec.rb
Ruby
mit
185
staging
11,918
# frozen_string_literal: true # rubocop:disable RSpec/DescribeClass require 'osctld/exceptions' require 'osctld/command' require 'osctld/utils/devices' require 'osctld/utils/cgroup_params' module OsCtld module Commands module Group; end end end require 'osctld/commands/container/device_add' require 'osctld/...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/commands/container/io_spec.rb
Ruby
mit
185
staging
13,630
# frozen_string_literal: true # rubocop:disable RSpec/DescribeClass, RSpec/ExpectInHook, RSpec/InstanceVariable, RSpec/VerifiedDoubles require 'stringio' require 'osctld/exceptions' require 'osctld/command' require 'osctld/container_control/command' require 'osctld/utils/switch_user' require 'osctld/commands/containe...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/commands/container/lifecycle_spec.rb
Ruby
mit
185
staging
32,847
# frozen_string_literal: true # rubocop:disable Lint/ConstantDefinitionInBlock, Lint/StructNewOverride, RSpec/DescribeClass, RSpec/LeakyConstantDeclaration, RSpec/VerifiedDoubles require 'fileutils' require 'ostruct' require 'osctld/exceptions' require 'osctld/command' require 'osctld/container_control/command' requi...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/run_state/start_config_spec.rb
Ruby
mit
185
staging
896
# frozen_string_literal: true require 'osctld/run_state/start_config' RSpec.describe OsCtld::RunState::StartConfig do it 'loads existing JSON config files' do with_tmpdir do |dir| path = File.join(dir, 'start.json') File.write(path, { 'booted' => true }.to_json) config = described_class.new(p...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/devices/mode_spec.rb
Ruby
mit
185
staging
962
# frozen_string_literal: true require 'osctld/devices/mode' RSpec.describe OsCtld::Devices::Mode do it 'normalizes, compares, and complements modes' do mode = described_class.new('mwrw') expect(mode.mode).to eq(%w[m r w]) expect(mode.to_s).to eq('rwm') expect(mode.compatible?(described_class.new('r...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/devices/lock_spec.rb
Ruby
mit
185
staging
919
# frozen_string_literal: true require 'osctld/devices/change_set' require 'osctld/devices/lock' RSpec.describe OsCtld::Devices::Lock do let(:pool) { FakeObjects::FakePool.new(name: 'tank') } before do described_class.instance.instance_variable_set('@pools', {}) end it 'reuses a mutex per pool' do mu...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/devices/change_set_spec.rb
Ruby
mit
185
staging
966
# frozen_string_literal: true require 'osctld/devices/change_set' RSpec.describe OsCtld::Devices::ChangeSet do let(:pool) { FakeObjects::FakePool.new(name: 'tank') } before do described_class.instance.instance_variable_set('@pools', {}) end it 'opens a per-pool changeset and stores managers by sort key'...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/devices/device_spec.rb
Ruby
mit
185
staging
1,504
# frozen_string_literal: true require 'osctld/devices/device' require 'osctld/devices/mode' RSpec.describe OsCtld::Devices::Device do it 'loads and imports devices with normalized fields' do loaded = described_class.load( 'type' => 'char', 'major' => '1', 'minor' => 'all', 'mode' => 'wr'...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/devices/manager_spec.rb
Ruby
mit
185
staging
2,587
# frozen_string_literal: true # rubocop:disable RSpec/MultipleMemoizedHelpers, RSpec/VerifiedDoubles require 'osctld/devices/change_set' require 'osctld/devices/configurator' require 'osctld/devices/device' require 'osctld/devices/lock' require 'osctld/devices/manager' require 'osctld/devices/mode' RSpec.describe Os...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/devices/v2/bpf_program_cache_spec.rb
Ruby
mit
185
staging
680
# frozen_string_literal: true require 'osctld/devices/device' require 'osctld/devices/mode' require 'osctld/bpf_fs' require 'osctld/devices/v2/bpf_program_cache' RSpec.describe OsCtld::Devices::V2::BpfProgramCache do let(:cache) { described_class.send(:new) } let(:dev_a) { OsCtld::Devices::Device.new(:char, 1, 3,...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container_control/command_spec.rb
Ruby
mit
185
staging
1,627
# frozen_string_literal: true require 'osctld/container_control/command' require 'osctld/container_control/result' RSpec.describe OsCtld::ContainerControl::Command do let(:command_class) do Class.new(described_class) do const_set( :Frontend, Class.new do def initialize(*); end ...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container_control/runner_spec.rb
Ruby
mit
185
staging
1,427
# frozen_string_literal: true require 'stringio' require 'osctld/switch_user' require 'osctld/container_control/runner' RSpec.describe OsCtld::ContainerControl::Runner do subject(:runner) do described_class.new( pool: 'tank', id: 'ct1', lxc_home: '/var/lib/lxc', user_home: '/home/alice',...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container_control/result_spec.rb
Ruby
mit
185
staging
586
# frozen_string_literal: true require 'osctld/container_control/result' RSpec.describe OsCtld::ContainerControl::Result do it 'maps successful runner results to data-bearing results' do result = described_class.from_runner(status: true, output: { state: 'running' }) expect(result.ok?).to be(true) expec...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container_control/commands/stop_spec.rb
Ruby
mit
185
staging
2,507
# frozen_string_literal: true require 'osctld/container_control/commands/stop' require 'osctld/container_control/result' RSpec.describe OsCtld::ContainerControl::Commands::Stop do subject(:frontend) do Class.new(described_class::Frontend) do attr_accessor :exec_result, :fork_result, :exec_calls, :fork_cal...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container_control/commands/state_spec.rb
Ruby
mit
185
staging
1,353
# frozen_string_literal: true require 'osctld/container_control/commands/state' require 'osctld/container_control/result' RSpec.describe OsCtld::ContainerControl::Commands::State do subject(:frontend) do Class.new(described_class::Frontend) do attr_accessor :fork_result def fork_runner fork...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container_control/commands/exec_spec.rb
Ruby
mit
185
staging
3,019
# frozen_string_literal: true require 'osctld/container_control/commands/exec' require 'osctld/container_control/result' require 'osctld/dist_config' require 'stringio' RSpec.describe OsCtld::ContainerControl::Commands::Exec do def build_mounts Struct.new(:pruned, keyword_init: true) do def prune ...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container_control/commands/wall_spec.rb
Ruby
mit
185
staging
1,184
# frozen_string_literal: true require 'stringio' require 'osctld/container_control/commands/wall' RSpec.describe OsCtld::ContainerControl::Commands::Wall do describe described_class::Runner do def build_runner(status) Class.new(described_class) do define_method(:initialize) do |wall_status:, **opt...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/prlimits/prlimit_spec.rb
Ruby
mit
185
staging
500
# frozen_string_literal: true require 'osctld/prlimits/prlimit' RSpec.describe OsCtld::PrLimits::PrLimit do it 'loads, updates, exports, and dumps prlimits' do prlimit = described_class.load('nofile', 'soft' => 1024, 'hard' => 2048) expect(prlimit.name).to eq('nofile') expect(prlimit.export).to eq(soft...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/prlimits/manager_spec.rb
Ruby
mit
185
staging
2,776
# frozen_string_literal: true require 'osctld/system_limits' require 'osctld/prlimits/prlimit' require 'osctld/prlimits/manager' RSpec.describe OsCtld::PrLimits::Manager do let(:ct) do FakeObjects::FakeRuntimeContainer.new( pool: Struct.new(:name).new('tank'), id: 'ct1', lxc_config: FakeObject...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/routing/route_spec.rb
Ruby
mit
185
staging
1,314
# frozen_string_literal: true require 'osctld/routing/route' RSpec.describe OsCtld::Routing::Route do it 'loads routes from strings and hashes' do string_route = described_class.load('192.0.2.1') hash_route = described_class.load('address' => '2001:db8::/64', 'via' => '2001:db8::1') expect(string_route...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/routing/table_spec.rb
Ruby
mit
185
staging
2,350
# frozen_string_literal: true require 'libosctl' require 'osctld/lock_registry' require 'osctld/lockable' require 'osctld/routing/route' require 'osctld/routing/table' RSpec.describe OsCtld::Routing::Table do subject(:table) { described_class.new } before do allow(OsCtld::LockRegistry).to receive(:register) ...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container/impermanence_spec.rb
Ruby
mit
185
staging
934
# frozen_string_literal: true require 'osctld/container/impermanence' RSpec.describe OsCtld::Container::Impermanence do it 'loads zfs properties from config' do impermanence = described_class.load( 'zfs_properties' => { 'com.example:keep' => '1' } ) expect(impermanence.zfs_propertie...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container/run_configuration_spec.rb
Ruby
mit
185
staging
6,364
# frozen_string_literal: true require 'osctld/exceptions' require 'osctld/promise' require 'osctld/container/run_id' require 'osctld/container/run_configuration' RSpec.describe OsCtld::Container::RunConfiguration do def build_run_configuration(root:, **opts) ct = build_run_config_container(root:, **opts) [c...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container/hooks_spec.rb
Ruby
mit
185
staging
1,980
# frozen_string_literal: true # rubocop:disable RSpec/MultipleMemoizedHelpers, RSpec/VerifiedDoubles require 'osctld/hook' require 'osctld/container/hooks' RSpec.describe OsCtld::Container::Hooks do let(:pool) { FakeObjects::FakePool.new(name: 'tank') } let(:user) { FakeObjects::FakeUser.new(name: 'alice', userd...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container/builder_spec.rb
Ruby
mit
185
staging
6,500
# frozen_string_literal: true # rubocop:disable RSpec/MultipleMemoizedHelpers, RSpec/VerifiedDoubles require 'osctld/utils/switch_user' require 'osctld/container/dataset_builder' require 'osctld/container/builder' RSpec.describe OsCtld::Container::Builder do let(:pool) { double(name: 'tank') } let(:user) { doubl...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container/dataset_builder_spec.rb
Ruby
mit
185
staging
2,392
# frozen_string_literal: true # rubocop:disable RSpec/VerifiedDoubles require 'tempfile' require 'osctld/utils/switch_user' require 'osctld/container/dataset_builder' RSpec.describe OsCtld::Container::DatasetBuilder do let(:builder) { described_class.new } let(:dataset) { double(mountpoint: '/tmp/test-dataset',...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container/adaptor_spec.rb
Ruby
mit
185
staging
2,126
# frozen_string_literal: true require 'osctld/container/adaptor' AdaptorSpecContainer = Struct.new(:log_type, keyword_init: true) RSpec.describe OsCtld::Container::Adaptor do let(:ct) { instance_double(AdaptorSpecContainer, log_type: 'ct=tank:ct1') } around do |example| original = described_class.instance_v...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container/start_menu_spec.rb
Ruby
mit
185
staging
2,540
# frozen_string_literal: true require 'osctld/container/start_menu' StartMenuSpecSharedDir = Struct.new(:path, :mountpoint, keyword_init: true) StartMenuSpecMountManager = Struct.new(:shared_dir, keyword_init: true) StartMenuSpecContainer = Struct.new(:mounts, :log_type, keyword_init: true) RSpec.describe OsCtld::Co...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container/lxc_config_spec.rb
Ruby
mit
185
staging
1,789
# frozen_string_literal: true # rubocop:disable RSpec/VerifiedDoubles require 'osctld/container/lxc_config' require 'osctld/assets/definition' require 'osctld/erb_template' RSpec.describe OsCtld::Container::LxcConfig do let(:run_conf) { double(distribution: 'alpine', version: '3.20') } let(:mounts) { double(all_...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container/hints_spec.rb
Ruby
mit
185
staging
4,587
# frozen_string_literal: true require 'osctld/lockable' require 'osctld/container/hints' HintsSpecContainer = Struct.new(:base_cgroup_path, keyword_init: true) class HintsSpecPathReader def read_stats(*); end end RSpec.describe OsCtld::Container::Hints do describe OsCtld::Container::Hints::CpuDaily do it 'l...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container/raw_configs_spec.rb
Ruby
mit
185
staging
1,045
# frozen_string_literal: true require 'osctld/container/raw_configs' RSpec.describe OsCtld::Container::RawConfigs do it 'loads configs with symbolized keys' do configs = described_class.load('lxc' => 'lxc.include = common.conf') expect(configs.lxc).to eq('lxc.include = common.conf') end it 'supports t...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container/importer_spec.rb
Ruby
mit
185
staging
6,413
# frozen_string_literal: true # rubocop:disable RSpec/VerifiedDoubles require 'yaml' require 'osctld/container/importer' RSpec.describe OsCtld::Container::Importer do let(:pool) { FakeObjects::FakePool.new(name: 'tank') } let(:metadata) do { 'format' => 'tar', 'user' => 'alice', 'group' =>...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container/run_id_spec.rb
Ruby
mit
185
staging
1,190
# frozen_string_literal: true require 'osctld/container/run_id' RSpec.describe OsCtld::Container::RunId do it 'uses the current timestamp when generating a run id' do now = Time.at(1_717_171_717.125) allow(Time).to receive(:now).and_return(now) run_id = described_class.new(pool_name: 'tank', container_...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container/recovery_spec.rb
Ruby
mit
185
staging
1,819
# frozen_string_literal: true # rubocop:disable RSpec/MultipleMemoizedHelpers, RSpec/VerifiedDoubles require 'osctld/container/recovery' RSpec.describe OsCtld::Container::Recovery do let(:pool) { FakeObjects::FakePool.new(name: 'tank') } let(:route) { double(addr: double(to_string: '10.0.0.1/32')) } let(:route...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/container/adaptors/cgroup_spec.rb
Ruby
mit
185
staging
2,358
# frozen_string_literal: true require 'osctld/container/adaptor' require 'osctld/container/adaptors/cgroup' CGroupAdaptorSpecContainer = Struct.new(:log_type, keyword_init: true) RSpec.describe OsCtld::Container::Adaptor::CGroup do let(:ct) { instance_double(CGroupAdaptorSpecContainer, log_type: 'ct=tank:ct1') } ...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/send_receive/server_spec.rb
Ruby
mit
185
staging
2,601
# frozen_string_literal: true require 'osctld/send_receive/server' RSpec.describe OsCtld::SendReceive::Server do subject(:server) { fresh_singleton(described_class) } before do stub_const('OsCtld::SendReceive::SOCKET', '/run/osctl/send-receive/control.sock') stub_const('OsCtld::SendReceive::UID', 23_456)...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/send_receive/log_spec.rb
Ruby
mit
185
staging
2,352
# frozen_string_literal: true require 'osctld/send_receive/log' RSpec.describe OsCtld::SendReceive::Log do let(:tokens_class) do Class.new do def self.free(*); end end end before do stub_const('OsCtld::SendReceive::Tokens', tokens_class) allow(OsCtld::SendReceive::Tokens).to receive(:free...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/send_receive/tokens_spec.rb
Ruby
mit
185
staging
1,922
# frozen_string_literal: true require 'osctld/send_receive/tokens' RSpec.describe OsCtld::SendReceive::Tokens do subject(:tokens) { described_class.send(:new) } let(:containers_class) do Class.new do def self.get [] end end end before do stub_const('OsCtld::DB::Containers', c...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/send_receive/command_spec.rb
Ruby
mit
185
staging
853
# frozen_string_literal: true require 'osctld/command' require 'osctld/send_receive' require 'osctld/send_receive/command' require 'osctld/send_receive/commands/base' RSpec.describe OsCtld::SendReceive::Command do around do |example| snapshot = OsCtld::Command.class_variable_get(:@@commands).transform_values(&:...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/send_receive/key_chain_spec.rb
Ruby
mit
185
staging
5,554
# frozen_string_literal: true require 'stringio' require 'yaml' require 'libosctl' require 'osctld/lock_registry' require 'osctld/send_receive/key_chain' RSpec.describe OsCtld::SendReceive::KeyChain do subject(:key_chain) { key_chain_class.new(pool) } let(:root) { Dir.mktmpdir('osctld-key-chain') } let(:pool) ...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/send_receive/commands/receive_incremental_spec.rb
Ruby
mit
185
staging
3,985
# frozen_string_literal: true # rubocop:disable RSpec/VerifiedDoubles require 'osctld/send_receive' require 'osctld/send_receive/command' require 'osctld/utils/receive' require 'osctld/send_receive/commands/receive_incremental' RSpec.describe OsCtld::SendReceive::Commands::ReceiveIncremental do def stub_receive_da...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/send_receive/commands/receive_cancel_spec.rb
Ruby
mit
185
staging
3,004
# frozen_string_literal: true require 'osctld/exceptions' require 'osctld/send_receive' require 'osctld/send_receive/command' require 'osctld/utils/receive' require 'osctld/send_receive/commands/receive_cancel' RSpec.describe OsCtld::SendReceive::Commands::ReceiveCancel do def build_send_log send_log_opts_class...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/send_receive/commands/receive_skel_spec.rb
Ruby
mit
185
staging
10,045
# frozen_string_literal: true # rubocop:disable Lint/ConstantDefinitionInBlock, RSpec/IndexedLet, RSpec/LeakyConstantDeclaration, RSpec/MultipleMemoizedHelpers, RSpec/VerifiedDoubles require 'stringio' require 'osctld/exceptions' require 'osctld/send_receive' require 'osctld/send_receive/command' require 'osctld/util...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/send_receive/commands/receive_base_spec.rb
Ruby
mit
185
staging
4,396
# frozen_string_literal: true # rubocop:disable RSpec/VerifiedDoubles require 'osctld/exceptions' require 'osctld/send_receive' require 'osctld/send_receive/command' require 'osctld/utils/receive' require 'osctld/send_receive/commands/receive_base' RSpec.describe OsCtld::SendReceive::Commands::ReceiveBase do def s...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/send_receive/commands/receive_transfer_spec.rb
Ruby
mit
185
staging
4,032
# frozen_string_literal: true require 'osctld/send_receive' require 'osctld/send_receive/command' require 'osctld/utils/receive' require 'osctld/send_receive/commands/receive_transfer' RSpec.describe OsCtld::SendReceive::Commands::Transfer do def build_send_log send_log_opts_class = Struct.new(:key_name, keywor...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/utils/container_spec.rb
Ruby
mit
185
staging
1,854
# frozen_string_literal: true require 'osctld/utils/container' RSpec.describe OsCtld::Utils::Container do let(:host_class) do Class.new do include OsCtld::Utils::Container attr_accessor :opts def error!(msg) raise msg end end end it 'returns a named repository when req...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/utils/switch_user_spec.rb
Ruby
mit
185
staging
1,724
# frozen_string_literal: true require 'ostruct' require 'osctld/utils/switch_user' RSpec.describe OsCtld::Utils::SwitchUser do let(:host) do Class.new do include OsCtld::Utils::SwitchUser def log(*) nil end end.new end it 'builds attach settings for the container user' do ...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/utils/receive_spec.rb
Ruby
mit
185
staging
1,384
# frozen_string_literal: true require 'ostruct' require 'osctld/utils/receive' RSpec.describe OsCtld::Utils::Receive do let(:host) do Class.new do include OsCtld::Utils::Receive def error!(msg) raise msg end def log(*) nil end end.new end it 'matches auth...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/utils/assets_spec.rb
Ruby
mit
185
staging
988
# frozen_string_literal: true require 'osctld/utils/assets' RSpec.describe OsCtld::Utils::Assets do it 'returns validated assets in exported form' do host = Class.new do include OsCtld::Utils::Assets end.new asset = Struct.new(:type, :path, :opts, :state, :errors, keyword_init: true).new( ty...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/utils/ip_spec.rb
Ruby
mit
185
staging
801
# frozen_string_literal: true require 'osctld/utils/ip' RSpec.describe OsCtld::Utils::Ip do let(:host) do Class.new do include OsCtld::Utils::Ip attr_reader :calls def initialize @calls = [] end def syscmd(cmd, opts) calls << [cmd, opts] :ok end ...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/cli/exec_spec.rb
Ruby
mit
185
staging
1,844
# frozen_string_literal: true module OsCtld module Cli; end end require 'osctld/cli/exec' RSpec.describe OsCtld::Cli::Exec do it 'prints usage and exits on invalid argv' do with_argv('settings.json') do expect do described_class.run end.to raise_error(SystemExit) end end it 'load...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/cli/runner_spec.rb
Ruby
mit
185
staging
3,091
# frozen_string_literal: true module OsCtld module Cli; end end require 'osctld/cli/runner' RSpec.describe OsCtld::Cli::Runner do it 'prints usage and exits when argv is not empty' do with_argv('unexpected') do expect do described_class.run end.to raise_error(SystemExit) end end ...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/cli/daemon_spec.rb
Ruby
mit
185
staging
1,270
# frozen_string_literal: true module OsCtld module Cli; end end require 'osctld/cli/daemon' RSpec.describe OsCtld::Cli::Daemon do let(:opts) { Struct.new(:log, :log_facility, :config).new(:stdout, 'daemon', '/etc/osctld.conf') } it 'sets up logging, creates the daemon, and traps stop signals once' do daem...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/cli/supervisor_spec.rb
Ruby
mit
185
staging
2,233
# frozen_string_literal: true module OsCtld module Cli; end end require 'osctld/cli/daemon' require 'osctld/cli/supervisor' RSpec.describe OsCtld::Cli::Supervisor do it 'parses defaults and overrides' do with_argv('--no-supervisor', '--config', '/etc/osctld.conf', '--log', 'syslog', '--log-facility', 'local0...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/pool/hooks_spec.rb
Ruby
mit
185
staging
761
# frozen_string_literal: true # rubocop:disable RSpec/VerifiedDoubles require 'osctld/hook' require 'osctld/pool/hooks' RSpec.describe OsCtld::Pool::Hooks do let(:pool) do double(name: 'tank', dataset: 'tank', state: :active) end it 'registers pool hook classes under the expected names' do expect(OsCt...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/auto_stop/plan_spec.rb
Ruby
mit
185
staging
5,495
# frozen_string_literal: true require 'osctld/continuous_executor' require 'osctld/progress_tracker' require 'osctld/auto_stop/plan' RSpec.describe OsCtld::AutoStop::Plan do def autostart_plan_double instance_double( Class.new do def clear_ct(_ct); end end, clear_ct: nil ) end ...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/console/container_spec.rb
Ruby
mit
185
staging
2,298
# frozen_string_literal: true require 'osctld/console' require 'osctld/console/container' RSpec.describe OsCtld::Console::Container do let(:ct) { Struct.new(:id).new('ct1') } let(:console_instances) { [] } let(:tty_instances) { [] } before do console_class = Class.new do attr_reader :ct, :n, :clien...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/console/tty_spec.rb
Ruby
mit
185
staging
2,698
# frozen_string_literal: true require 'osctld/utils/switch_user' require 'osctld/console' require 'osctld/console/tty' RSpec.describe OsCtld::Console::TTY do before do allow(OsCtl::Lib::Logger).to receive(:log) end def build_ct(state: :running) user = Struct.new(:ugid).new(1234) pool = Struct.new(:...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/console/console_spec.rb
Ruby
mit
185
staging
6,233
# frozen_string_literal: true require 'osctld/exceptions' require 'osctld/utils/switch_user' require 'osctld/console' require 'osctld/console/console' RSpec.describe OsCtld::Console::Console do let(:run_conf_class) do Class.new do def aborted?; end def destroy_dataset_on_stop?; end def reboo...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/generic/server_spec.rb
Ruby
mit
185
staging
1,709
# frozen_string_literal: true require 'osctld/generic/server' RSpec.describe OsCtld::Generic::Server do it 'spawns a handler thread for accepted clients and registers it with ThreadReaper' do server_socket_class = Class.new do def accept; end def close; end end client_socket_class = Class.n...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/osctld/generic/client_handler_spec.rb
Ruby
mit
185
staging
5,220
# frozen_string_literal: true require 'osctld/exceptions' require 'osctld/generic/client_handler' RSpec.describe OsCtld::Generic::ClientHandler do def write_json_line(io, data) io.write("#{data.to_json}\n") end let(:handler_class) do Class.new(described_class) do class << self attr_access...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/hook_helpers.rb
Ruby
mit
185
staging
245
# frozen_string_literal: true module HookHelpers def write_executable(path, body = "#!/bin/sh\nexit 0\n") File.write(path, body) File.chmod(0o755, path) path end end RSpec.configure do |config| config.include HookHelpers end
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/config_helpers.rb
Ruby
mit
185
staging
550
# frozen_string_literal: true require 'fileutils' require 'libosctl/config_file' module ConfigHelpers def load_yaml_file(path) OsCtl::Lib::ConfigFile.load_yaml_file(path) end def dump_yaml(hash) OsCtl::Lib::ConfigFile.dump_yaml(hash) end def write_yaml_file(path, hash) File.write(path, dump_ya...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/db_registry_helpers.rb
Ruby
mit
185
staging
1,481
# frozen_string_literal: true module DbRegistryHelpers def stub_containers_registry(containers) stub_const('OsCtld::DB::Containers', Object.new.tap do |registry| registry.define_singleton_method(:get) do |&block| block ? block.call(containers) : containers end registry.define_singleton...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/runtime_policy_helpers.rb
Ruby
mit
185
staging
1,577
# frozen_string_literal: true module RuntimePolicyHelpers class RecordingExecutor attr_reader :enqueued, :removed_ids, :resized_to, :executed, :last_timeout def initialize @enqueued = [] @removed_ids = [] @executed = [] @resized_to = nil @cleared = false @stopped = false ...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/container_helpers.rb
Ruby
mit
185
staging
13,831
# frozen_string_literal: true require 'fileutils' module ContainerHelpers FakeSharedDir = Struct.new(:path, :mountpoint, keyword_init: true) do def dup(_new_ct = nil) self.class.new(path:, mountpoint:) end end FakeNetInterface = Struct.new(:can_run_distconfig, keyword_init: true) do def can_r...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/tar_helpers.rb
Ruby
mit
185
staging
643
# frozen_string_literal: true require 'rubygems/package' require 'stringio' module TarHelpers def build_tar(entries) io = StringIO.new Gem::Package::TarWriter.new(io) do |tar| entries.each do |entry| name = entry.fetch(:name) mode = entry.fetch(:mode, 0o644) if entry[:type] =...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/cgroup_helpers.rb
Ruby
mit
185
staging
478
# frozen_string_literal: true require 'fileutils' module CgroupHelpers def write_cgroup_file(root, *parts, content: '') path = File.join(root, *parts) FileUtils.mkdir_p(File.dirname(path)) File.write(path, content) path end def mkdir_cgroup(root, *parts) path = File.join(root, *parts) F...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/process_helpers.rb
Ruby
mit
185
staging
214
# frozen_string_literal: true module ProcessHelpers def build_wait_status(exitstatus) instance_double(Process::Status, exitstatus:) end end RSpec.configure do |config| config.include ProcessHelpers end
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/queue_helpers.rb
Ruby
mit
185
staging
302
# frozen_string_literal: true require 'timeout' module QueueHelpers def pop_with_timeout(queue, timeout: 2) Timeout.timeout(timeout) { queue.pop } rescue Timeout::Error raise "queue pop timed out after #{timeout}s" end end RSpec.configure do |config| config.include QueueHelpers end
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/daemon_helpers.rb
Ruby
mit
185
staging
983
# frozen_string_literal: true module DaemonHelpers SchedulerPackageConfig = Struct.new(:cpu_mask, :enable, keyword_init: true) SchedulerConfig = Struct.new( :enable_flag, :min_package_container_count_percent, :packages, :sequential_start_priority_threshold, keyword_init: true ) do def en...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/utmp_helpers.rb
Ruby
mit
185
staging
947
# frozen_string_literal: true module UtmpHelpers def build_utmp_entry(type: :user_process, pid: 1234, line: 'pts/0', id: 'p0', user: 'alice', host: '', session: 1, sec: 1, usec: 0, addr: [0, 0, 0, 0]) ut_type = OsCtld::UtmpReader::Entry::TYPES.index(type) raise A...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/argv_helpers.rb
Ruby
mit
185
staging
238
# frozen_string_literal: true module ArgvHelpers def with_argv(*argv) old_argv = ARGV.dup ARGV.replace(argv) yield ensure ARGV.replace(old_argv) end end RSpec.configure do |config| config.include ArgvHelpers end
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/repository_user_bootstrap.rb
Ruby
mit
185
staging
558
# frozen_string_literal: true require 'etc' fake_entries = {} { 'repository' => 12_345, 'osctl-ct-receive' => 23_456 }.each do |name, uid| Etc.getpwnam(name) rescue ArgumentError fake_entries[name] = Struct.new(:uid).new(uid) end if fake_entries.any? class << Etc alias __osctld_spec_original_getpwnam ...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/namespace_bootstrap.rb
Ruby
mit
185
staging
3,241
# frozen_string_literal: true require 'osctld/assets' require 'osctld/lock_registry' module OsCtld IdRange = Class.new unless const_defined?(:IdRange) Repository = Class.new unless const_defined?(:Repository) Container = Class.new unless const_defined?(:Container) Pool = Class.new unless const_defined?(:Pool)...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/socket_helpers.rb
Ruby
mit
185
staging
823
# frozen_string_literal: true require 'socket' require 'json' require 'timeout' module SocketHelpers def with_socket_pair sockets = Socket.pair(:UNIX, :STREAM, 0) yield(*sockets) ensure sockets&.each do |sock| sock.close unless sock.closed? rescue IOError nil end end def read_...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/spec/support/fake_objects.rb
Ruby
mit
185
staging
6,855
# frozen_string_literal: true require 'fileutils' module FakeObjects FakeIdMapEntry = Struct.new(:ns_id, :host_id, :id_count, keyword_init: true) do def to_a = [ns_id, host_id, id_count] def to_h { ns_id:, host_id:, id_count: } end def to_s = "#{ns_id}:#{host_id...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld.rb
Ruby
mit
185
staging
2,201
require 'require_all' require 'osctld/native' module OsCtld module AutoStart; end module AutoStop; end module Commands module Container; end module CpuScheduler; end module Dataset; end module Debug; end module Event; end module GarbageCollector; end module Group; end module Hist...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/user.rb
Ruby
mit
185
staging
5,021
require 'fileutils' require 'libosctl' require 'osctld/lockable' require 'osctld/manipulable' require 'osctld/assets/definition' module OsCtld class User include Lockable include Manipulable include Assets::Definition include OsCtl::Lib::Utils::Log include OsCtl::Lib::Utils::File attr_inclus...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/bpf_fs.rb
Ruby
mit
185
staging
1,665
require 'fileutils' require 'forwardable' require 'singleton' module OsCtld class BpfFs include Singleton FS = '/sys/fs/bpf'.freeze ROOT_DIR = File.join(FS, 'osctl') PROG_DIR = File.join(ROOT_DIR, 'progs') POOL_DIR = File.join(ROOT_DIR, 'pools') class << self extend Forwardable ...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/garbage_collector.rb
Ruby
mit
185
staging
6,312
require 'libosctl' module OsCtld # Ensures that temporary datasets are moved to trash after they're not needed # # It can be used to tie datasets to specific container runs. Add dataset using # {#add_container_run_dataset} and it will be kept as long as the same run configuration # is active. When the contai...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/daemon.rb
Ruby
mit
185
staging
5,837
require 'json' require 'libosctl' require 'socket' require 'osctld/assets/definition' require 'osctld/run_state' require 'osctld/generic/client_handler' module OsCtld class Daemon include OsCtl::Lib::Utils::Log include OsCtl::Lib::Utils::System include Assets::Definition SOCKET = File.join(RunState:...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/cpu_scheduler.rb
Ruby
mit
185
staging
17,570
require 'singleton' require 'libosctl' require 'osctld/run_state' module OsCtld # Schedule containers on CPUs to keep them running on the same package class CpuScheduler STATE_FILE = File.join(RunState::CPU_SCHEDULER_DIR, 'state.yml') include Singleton include Lockable include OsCtl::Lib::Utils::...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/eventd.rb
Ruby
mit
185
staging
354
module OsCtld module Eventd class << self def instance @instance ||= Eventd::Manager.new end %i[start stop shutdown subscribe unsubscribe report broadcast].each do |m| define_method(m) do |*args, **kwargs, &block| instance.method(m).call(*args, **kwargs, &block) ...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/apparmor.rb
Ruby
mit
185
staging
5,193
require 'libosctl' require 'osctld/run_state' module OsCtld class AppArmor include OsCtl::Lib::Utils::Log include OsCtl::Lib::Utils::System extend OsCtl::Lib::Utils::System # Paths where `apparmor_parser` searches for configuration files PATHS = [RunState::APPARMOR_DIR].freeze def self.enab...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/ugid_registry.rb
Ruby
mit
185
staging
1,946
require 'singleton' require 'osctld/lockable' module OsCtld # Registry for user/group IDs allocated to dynamic users class UGidRegistry ID_POOL = (100_000..199_999) include Singleton include Lockable class << self def setup instance end %i[<< remove taken? get export].e...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/osctl_repo.rb
Ruby
mit
185
staging
3,764
require 'etc' require 'json' require 'libosctl' require 'osctl/repo/locator' require 'osctl/repo/constants' module OsCtld class OsCtlRepo include OsCtl::Lib::Utils::Log # @return [Repository] attr_reader :repo # @param repo [Repository] def initialize(repo) @repo = repo end # @re...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/switch_user.rb
Ruby
mit
185
staging
5,315
require 'libosctl' module OsCtld module SwitchUser include OsCtl::Lib::Utils::Log extend OsCtl::Lib::Utils::System SYSTEM_PATH = %w[ /bin /usr/bin /sbin /usr/sbin /run/current-system/sw/bin /nix/var/nix/profiles/system/sw/bin /run/current-system/profile/bin ...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/assets.rb
Ruby
mit
185
staging
285
module OsCtld module Assets def self.register(type, klass) @types ||= {} @types[type] = klass end def self.types return [] unless @types @types.keys end def self.for_type(t) return unless @types @types[t] end end end
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/lxc.rb
Ruby
mit
185
staging
1,170
require 'fileutils' module OsCtld module Lxc CONFIGS = '/run/osctl/configs/lxc'.freeze def self.dist_name(dist) case dist when 'suse' 'opensuse' else dist end end def self.dist_lxc_configs(dist, ver) name = dist_name(dist) [ File.join(CO...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/promise.rb
Ruby
mit
185
staging
630
require 'libosctl' module OsCtld class Promise class Token def initialize @queue = OsCtl::Lib::Queue.new end # Wait until the promise is fulfilled # @param timeout [Integer] # @return [true, nil] def wait(timeout: 60) @queue.pop(timeout:) end # Fu...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/id_range.rb
Ruby
mit
185
staging
5,002
require 'libosctl' require 'osctld/lockable' require 'osctld/manipulable' require 'osctld/assets/definition' module OsCtld class IdRange class AllocationError < StandardError; end include Lockable include Manipulable include Assets::Definition include OsCtl::Lib::Utils::File attr_reader :po...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/hint_updater.rb
Ruby
mit
185
staging
1,363
require 'libosctl' module OsCtld # Update container hints at regular intervals class HintUpdater include OsCtl::Lib::Utils::Log include OsCtl::Lib::Utils::Exception # @param pool [Pool] def initialize(pool) @pool = pool @ct_queue = OsCtl::Lib::Queue.new end def start rai...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/attributes.rb
Ruby
mit
185
staging
1,227
require 'osctld/lockable' module OsCtld # Storage of user attributes class Attributes # Load attributes from config # @param cfg [Hash] def self.load(cfg) ret = new cfg.each { |k, v| ret.set(k, v) } ret end include Lockable def initialize init_lock @attrs = {...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/lock_registry.rb
Ruby
mit
185
staging
3,531
require 'libosctl' require 'concurrent' require 'singleton' module OsCtld # Global registry of all inclusive/exclusive logs for debugging purposes # # All inclusive/exclusive locks that are attempted and held are registered # in this class. The idea is that when a deadlock occurs, you can inspect # the data ...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/send_receive.rb
Ruby
mit
185
staging
1,590
require 'etc' require 'libosctl' require 'osctld/run_state' module OsCtld module SendReceive module Commands; end extend OsCtl::Lib::Utils::File USER = 'osctl-ct-receive'.freeze UID = Etc.getpwnam(USER).uid SOCKET = File.join(RunState::SEND_RECEIVE_DIR, 'control.sock') AUTHORIZED_KEYS = Fil...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/run_state.rb
Ruby
mit
185
staging
2,939
require 'fileutils' module OsCtld module RunState RUNDIR = '/run/osctl'.freeze POOL_DIR = File.join(RUNDIR, 'pools') USER_CONTROL_DIR = File.join(RUNDIR, 'user-control') SEND_RECEIVE_DIR = File.join(RUNDIR, 'send-receive') REPOSITORY_DIR = File.join(RUNDIR, 'repository') CONFIG_DIR = File.joi...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/hook.rb
Ruby
mit
185
staging
1,567
require 'libosctl' module OsCtld module Hook extend OsCtl::Lib::Utils::Log # Register hook # @param event_class [Class] # @param hook_name [Symbol] # @param hook_class [Class] def self.register(event_class, hook_name, hook_class) @hooks ||= {} @hooks[event_class] ||= {} @ho...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/dist_config.rb
Ruby
mit
185
staging
1,225
require 'libosctl' module OsCtld module DistConfig module Distributions; end module Helpers; end module Network; end extend OsCtl::Lib::Utils::Exception def self.register(distribution, klass) @dists ||= {} @dists[distribution] = klass end def self.for(distribution) @d...
github
vpsfreecz/vpsadminos
https://github.com/vpsfreecz/vpsadminos
osctld/lib/osctld/exceptions.rb
Ruby
mit
185
staging
3,159
require 'libosctl' module OsCtld SystemCommandFailed = OsCtl::Lib::Exceptions::SystemCommandFailed class ConfigError < StandardError # @return [Exception, nil] original exception attr_reader :original_exception def initialize(msg, original_exception = nil) super(msg) @original_exception =...