Remove the test_gets_num_clients test from the C unit tests
This test was causing problems by using dummy pointers to simulate connections. When calling the cleanup code, these pointers were thought to be real, and the code attemtped to clean up threads referenced by those pointers, causing a segfault. I've reimplemented the test in the ruby acceptance suite.
This commit is contained in:
@@ -209,12 +209,15 @@ class TestServeMode < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_status_returns_correct_client_count
|
def test_status_returns_correct_client_count
|
||||||
require 'pp'
|
@env.writefile1('0')
|
||||||
connect_to_server do |client|
|
@env.serve1
|
||||||
status = @env.status1
|
assert_equal('0', @env.status1['num_clients'])
|
||||||
assert_equal('1', status['num_clients'])
|
client = FlexNBD::FakeSource.new(@env.ip, @env.port1, 'Connecting to server failed')
|
||||||
end
|
assert_equal('1', @env.status1['num_clients'])
|
||||||
status = @env.status1
|
client2 = FlexNBD::FakeSource.new(@env.ip, @env.port1, 'Connecting to server failed')
|
||||||
assert_equal('0', status['num_clients'])
|
assert_equal('2', @env.status1['num_clients'])
|
||||||
|
client2.close
|
||||||
|
client.close
|
||||||
|
assert_equal('0', @env.status1['num_clients'])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@@ -105,25 +105,6 @@ START_TEST( test_gets_clients_allowed )
|
|||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST( test_gets_num_clients )
|
|
||||||
{
|
|
||||||
struct server * server = mock_server();
|
|
||||||
struct status * status = status_create( server );
|
|
||||||
|
|
||||||
fail_if( status->num_clients != 0, "num_clients was wrong" );
|
|
||||||
status_destroy( status );
|
|
||||||
|
|
||||||
server->nbd_client[0].thread = 1;
|
|
||||||
server->nbd_client[1].thread = 1;
|
|
||||||
status = status_create( server );
|
|
||||||
|
|
||||||
fail_unless( status->num_clients == 2, "num_clients was wrong" );
|
|
||||||
status_destroy( status );
|
|
||||||
destroy_mock_server( server );
|
|
||||||
|
|
||||||
}
|
|
||||||
END_TEST
|
|
||||||
|
|
||||||
START_TEST( test_gets_pid )
|
START_TEST( test_gets_pid )
|
||||||
{
|
{
|
||||||
struct server * server = mock_server();
|
struct server * server = mock_server();
|
||||||
|
Reference in New Issue
Block a user