Skip to content

Commit

Permalink
switch to east and conditionally check os
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyzha0 committed Aug 26, 2024
1 parent 829150a commit 899ecfa
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Pty, getCloseOnExec, setCloseOnExec } from '../wrapper';
import { type Writable } from 'stream';
import { readdirSync, readlinkSync } from 'fs';
import { describe, test, expect, beforeAll, afterAll } from 'vitest';
import { describe, test, expect, beforeEach, afterEach } from 'vitest';
import { exec as execAsync } from 'child_process';
import { promisify } from 'util';
const exec = promisify(execAsync);
Expand Down Expand Up @@ -419,15 +419,19 @@ describe(
);

describe('cgroup opts', () => {
beforeAll(async () => {
// create a new cgroup with the right permissions
await exec("sudo cgcreate -g 'cpu:/test.slice'")
await exec("sudo chown -R $(id -u):$(id -g) /sys/fs/cgroup/cpu/test.slice")
beforeEach(async () => {
if (!IS_DARWIN) {
// create a new cgroup with the right permissions
await exec("sudo cgcreate -g 'cpu:/test.slice'")
await exec("sudo chown -R $(id -u):$(id -g) /sys/fs/cgroup/cpu/test.slice")
}
});

afterAll(async () => {
// remove the cgroup
await exec("sudo cgdelete cpu:/test.slice")
afterEach(async () => {
if (!IS_DARWIN) {
// remove the cgroup
await exec("sudo cgdelete cpu:/test.slice")
}
});

testSkipOnDarwin('basic cgroup', () => new Promise<void>((done) => {
Expand Down

0 comments on commit 899ecfa

Please sign in to comment.