diff --git a/test/perl5/libdnf5/conf/test_vars.t b/test/perl5/libdnf5/conf/test_vars.t
new file mode 100644
index 0000000000..7379deb54a
--- /dev/null
+++ b/test/perl5/libdnf5/conf/test_vars.t
@@ -0,0 +1,43 @@
+# Copyright Contributors to the libdnf project.
+#
+# This file is part of libdnf: https://github.com/rpm-software-management/libdnf/
+#
+# Libdnf is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# Libdnf is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with libdnf. If not, see .
+
+use strict;
+use warnings;
+
+use Test::More;
+
+use FindBin;
+use lib "$FindBin::Bin/.."; # Add to search path
+use BaseTestCase;
+
+use File::Spec::Functions 'catfile';
+
+use libdnf5::conf;
+
+
+# test_detect_release
+{
+ my $test = new BaseTestCase();
+
+ my $installroot = $test->{base}->get_config()->get_installroot_option()->get_value();
+
+ # Cannot detect release in nonexistent directory, return undef
+ my $release = libdnf5::conf::Vars::detect_release($test->{base}->get_weak_ptr(), catfile($installroot, "nonexist"));
+ is($release, undef);
+}
+
+done_testing();
diff --git a/test/python3/libdnf5/conf/test_vars.py b/test/python3/libdnf5/conf/test_vars.py
index 8ec24e8a9f..b146c3cdf5 100644
--- a/test/python3/libdnf5/conf/test_vars.py
+++ b/test/python3/libdnf5/conf/test_vars.py
@@ -15,6 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with libdnf. If not, see .
+import os
+
+import libdnf5
+
import base_test_case
@@ -22,3 +26,10 @@ class TestVars(base_test_case.BaseTestCase):
def test_getting_undefined_variable(self):
vars = self.base.get_vars()
self.assertRaises(IndexError, vars.get_value, "undefined")
+
+ def test_detect_release(self):
+ installroot = self.base.get_config().installroot
+ # Cannot detect release in nonexistent directory, return None
+ release = libdnf5.conf.Vars.detect_release(
+ self.base.get_weak_ptr(), os.path.join(installroot, "nonexist"))
+ self.assertEqual(release, None)
diff --git a/test/ruby/libdnf5/conf/test_vars.rb b/test/ruby/libdnf5/conf/test_vars.rb
new file mode 100644
index 0000000000..4dba4922da
--- /dev/null
+++ b/test/ruby/libdnf5/conf/test_vars.rb
@@ -0,0 +1,33 @@
+# Copyright Contributors to the libdnf project.
+#
+# This file is part of libdnf: https://github.com/rpm-software-management/libdnf/
+#
+# Libdnf is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# Libdnf is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with libdnf. If not, see .
+
+require 'test/unit'
+include Test::Unit::Assertions
+
+require 'libdnf5/conf'
+
+require 'base_test_case'
+
+
+class TestVars < BaseTestCase
+ def test_detect_release()
+ installroot = @base.get_config().get_installroot_option().get_value()
+ # Cannot detect release in nonexistent directory, return nil
+ release = Conf::Vars::detect_release(@base.get_weak_ptr(), File.join(installroot, "nonexist"))
+ assert_equal(nil, release)
+ end
+end