Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test that meminfo is functional #40

Merged
merged 2 commits into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions test/container/functional/meminfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

const MEMINFO_DUMP_FILE = '/tmp/my_dump_file.json';

meminfo_dump(fopen(MEMINFO_DUMP_FILE, 'w'));

sleep(1);

if (!file_exists(MEMINFO_DUMP_FILE)) {
exit(1);
}

$json = json_decode(file_get_contents(MEMINFO_DUMP_FILE), true);

if (!is_array($json)) {
exit(1);
}

if (count($json) === 0) {
exit(1);
}

echo 'meminfo';
6 changes: 6 additions & 0 deletions test/container/test_php_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ def test_php_meminfo_is_enabled(host):
def test_php_meminfo_is_not_enabled(host):
output = host.run('php -r "exit(function_exists(\'meminfo_dump\') ? 0 : 255);"')
assert output.rc == 255

@pytest.mark.php_dev
def test_php_ext_meminfo_is_functional(host):
output = host.run('php /tests/container/functional/meminfo.php')
assert output.stdout == 'meminfo'
assert output.rc == 0
6 changes: 5 additions & 1 deletion test/container/test_php_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ def test_iconv_is_loaded(host):
def test_intl_is_loaded(host):
assert 'intl' in host.run('php -m').stdout

@pytest.mark.php_dev
def test_meminfo_is_loaded(host):
assert 'meminfo' in host.run('php -m').stdout

@pytest.mark.php_zts
def test_paralle_is_loaded(host):
def test_parallel_is_loaded(host):
assert 'parallel' in host.run('php -m').stdout

@pytest.mark.php_nts
Expand Down