def test_dpkg_manager_identify_packages(): files = ["/sbin/iptables"] tracer = DebTracer() (packages, unknown_files) = \ tracer.identify_packages_from_files(files) # Make sure that iptables was identified assert (not unknown_files), "/sbin/iptables should be identified" assert len(packages) == 1 pkg = packages[0] assert pkg.name == 'iptables' # Make sure apt_sources are identified, but then we should ask the entire # distribution distributions = list(tracer.identify_distributions(files)) assert len(distributions) == 1 distribution, unknown_files = distributions[0] assert distribution.apt_sources # Make sure both a non-local origin was found for o in distribution.apt_sources: if o.site: # Loop over mandatory attributes for a in [ "name", "component", "origin", "label", "site", "archive_uri" ]: assert getattr(o, a), "A non-local origin needs a " + a # Note: date and architecture are not mandatory (and not found on # travis) break else: assert False, "A non-local origin must be found"
def test_check_bin_packages(): # Gather files in /usr/bin and /usr/lib files = list_all_files("/usr/bin") + list_all_files("/usr/lib") tracer = DebTracer() distributions = list(tracer.identify_distributions(files)) assert len(distributions) == 1 distribution, unknown_files = distributions[0] non_local_origins = [o for o in distribution.apt_sources if o.site] assert len(non_local_origins) > 0, "A non-local origin must be found" for o in non_local_origins: # Loop over mandatory attributes for a in [ "name", "component", "origin", "label", "site", "archive_uri" ]: try: assert getattr(o, a), "A non-local origin needs a " + a except AssertionError: # FIXME? On the Ubuntu GitHub CI run, this entry has an empty # string for component. Is that an issue? # # APTSource(name='apt_obs://build.opensuse.org/devel:kubic:...', # component='', archive=None, architecture=None, # codename='xUbuntu_18.04', ...) if getattr(o, "label") == "devel:kubic:libcontainers:stable" \ and a == "component" and "GITHUB_WORKFLOW" in os.environ: continue raise
def test_check_bin_packages(): # Gather files in /usr/bin and /usr/lib files = list_all_files("/usr/bin") + list_all_files("/usr/lib") tracer = DebTracer() distributions = list(tracer.identify_distributions(files)) assert len(distributions) == 1 distribution, unknown_files = distributions[0] non_local_origins = [o for o in distribution.apt_sources if o.site] assert len(non_local_origins) > 0, "A non-local origin must be found" for o in non_local_origins: # Loop over mandatory attributes for a in [ "name", "component", "origin", "label", "site", "archive_uri" ]: assert getattr(o, a), "A non-local origin needs a " + a