INNER CODE UNIT · Python

post_new_chart

helm/chartmuseum · loadtesting/locustfile.py:13

    def post_new_chart(self):
        global patch_version
        # Create dummy 'chartmuseum-loadtest' chart package for which we only increment the patch version
        chart_post_field_name = 'chart'
        chart_name = 'chartmuseum-loadtest'
        chart_version = '0.0.%d' % patch_version
        patch_version += 1
        chart_fn = '%s-%s.tgz' % (chart_name, chart_version)

        tgz_buf = io.BytesIO()
        t = tarfile.open(mode = "w:gz", fileobj=tgz_buf)
        chart_content = b'name: %s\nversion: %s\n' % (chart_name.encode('utf8'), chart_version.encode('utf8'))
        tarinfo = tarfile.TarInfo('%s/Chart.yaml' % chart_name)
        tarinfo.size = len(chart_content)
        t.addfile(tarinfo=tarinfo, fileobj=io.BytesIO(chart_content))
        t.close()
        tgz_buf.seek(0)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…