How to use the rocker.core.list_plugins function in rocker

To help you get started, we’ve selected a few rocker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github osrf / rocker / test / test_nvidia.py View on Github external
def test_x11_xpdyinfo(self):
        plugins = list_plugins()
        desired_plugins = ['x11']
        active_extensions = [e() for e in plugins.values() if e.get_name() in desired_plugins]
        for tag in self.dockerfile_tags:
            dig = DockerImageGenerator(active_extensions, {}, tag)
            self.assertEqual(dig.build(), 0)
            self.assertEqual(dig.run(), 0)
github osrf / rocker / test / test_nvidia.py View on Github external
def test_x11_extension_basic(self):
        plugins = list_plugins()
        x11_plugin = plugins['x11']
        self.assertEqual(x11_plugin.get_name(), 'x11')
        self.assertTrue(plugin_load_parser_correctly(x11_plugin))
        
        p = x11_plugin()
        mock_cliargs = {'base_image': 'ubuntu:xenial'}

        docker_args = p.get_docker_args(mock_cliargs)
        self.assertIn(' -e DISPLAY -e TERM', docker_args)
        self.assertIn(' -e QT_X11_NO_MITSHM=1', docker_args)
        self.assertIn(' -e XAUTHORITY=', docker_args)
        self.assertIn(' -v /tmp/.X11-unix:/tmp/.X11-unix ', docker_args)
        self.assertIn(' -v /etc/localtime:/etc/localtime:ro ', docker_args)
github osrf / rocker / test / test_nvidia.py View on Github external
def test_nvidia_extension_basic(self):
        plugins = list_plugins()
        nvidia_plugin = plugins['nvidia']
        self.assertEqual(nvidia_plugin.get_name(), 'nvidia')
        self.assertTrue(plugin_load_parser_correctly(nvidia_plugin))
        
        p = nvidia_plugin()
        mock_cliargs = {'base_image': 'ubuntu:xenial'}
        snippet = p.get_snippet(mock_cliargs)

        self.assertIn('COPY --from=glvnd /usr/local/lib/x86_64-linux-gnu /usr/local/lib/x86_64-linux-gnu', snippet)
        self.assertIn('COPY --from=glvnd /usr/local/lib/i386-linux-gnu /usr/local/lib/i386-linux-gnu', snippet)
        self.assertIn('ENV LD_LIBRARY_PATH /usr/local/lib/x86_64-linux-gnu:/usr/local/lib/i386-linux-gnu', snippet)
        self.assertIn('NVIDIA_VISIBLE_DEVICES', snippet)
        self.assertIn('NVIDIA_DRIVER_CAPABILITIES', snippet)

        mock_cliargs = {'base_image': 'ubuntu:bionic'}
        snippet = p.get_snippet(mock_cliargs)
github osrf / rocker / test / test_nvidia.py View on Github external
def test_nvidia_glmark2(self):
        plugins = list_plugins()
        desired_plugins = ['x11', 'nvidia', 'user'] #TODO(Tfoote) encode the x11 dependency into the plugin and remove from test here
        active_extensions = [e() for e in plugins.values() if e.get_name() in desired_plugins]
        for tag in self.dockerfile_tags:
            dig = DockerImageGenerator(active_extensions, {}, tag)
            self.assertEqual(dig.build(), 0)
            self.assertEqual(dig.run(), 0)