Example #1
0
    def test_positive_create_with_start_date(self):
        """Create Sync plan with specified start date

        :id: 020b3aff-7216-4ad6-b95e-8ffaf68cba20

        :expectedresults: Sync Plan is created with the specified date

        :BZ: 1460146

        :CaseLevel: Integration
        """
        plan_name = gen_string('alpha')
        with Session(self) as session:
            startdate = (self.get_client_datetime(session.browser)
                         + timedelta(days=10))
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start date',
                startdate=startdate.strftime("%Y-%m-%d"),
            )
            self.assertIsNotNone(self.syncplan.search(plan_name))
            self.syncplan.click(self.syncplan.search(plan_name))
            startdate_text = self.syncplan.wait_until_element(
                locators['sp.fetch_startdate']).text
            self.assertEqual(
                str(startdate_text).partition(' ')[0],
                startdate.strftime("%Y/%m/%d")
            )
Example #2
0
    def test_positive_synchronize_custom_products_future_sync_date(self):
        """Create a sync plan with sync date in a future and sync multiple
        custom products with multiple repos automatically.

        @id: 9564e726-59c6-4d24-bb3d-f0ab3c4b26a5

        @Assert: Products are synchronized successfully.

        @CaseLevel: System
        """
        delay = 10 * 60  # delay for sync date in seconds
        plan_name = gen_string('alpha')
        products = [
            entities.Product(organization=self.organization).create()
            for _ in range(randint(3, 5))
        ]
        repos = [
            entities.Repository(product=product).create()
            for product in products for _ in range(randint(2, 3))
        ]
        startdate = datetime.now() + timedelta(seconds=delay)
        with Session(self.browser) as session:
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            #  Verify products have not been synced yet
            for repo in repos:
                self.validate_repo_content(
                    repo.product.read().name,
                    repo.name,
                    ['errata', 'package_groups', 'packages'],
                    after_sync=False,
                )
            # Associate sync plan with products
            self.syncplan.update(
                plan_name, add_products=[product.name for product in products])
            # Wait half of expected time
            sleep(delay / 2)
            # Verify products has not been synced yet
            for repo in repos:
                self.validate_repo_content(
                    repo.product.read().name,
                    repo.name,
                    ['errata', 'package_groups', 'packages'],
                    after_sync=False,
                )
            # Wait the rest of expected time
            sleep(delay / 2)
            # Verify product was synced successfully
            for repo in repos:
                self.validate_repo_content(
                    repo.product.read().name,
                    repo.name,
                    ['errata', 'package_groups', 'packages'],
                )
Example #3
0
    def test_negative_synchronize_custom_product_past_sync_date(self):
        """Verify product won't get synced immediately after adding association
        with a sync plan which has already been started

        :id: b56fccb9-8f84-4676-a777-b3c6458c909e

        :expectedresults: Repository was not synchronized

        :BZ: 1279539

        :CaseLevel: System
        """
        plan_name = gen_string('alpha')
        product = entities.Product(organization=self.organization).create()
        repo = entities.Repository(product=product).create()
        with Session(self) as session:
            startdate = self.get_client_datetime(session.browser)
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                startdate=startdate.strftime('%Y-%m-%d'),
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            self.syncplan.update(
                plan_name, add_products=[product.name])
            with self.assertRaises(AssertionError):
                self.validate_task_status(repo.id, max_tries=2)
                self.validate_repo_content(
                    repo,
                    ['erratum', 'package', 'package_group'],
                    max_attempts=5,
                )
Example #4
0
    def test_negative_synchronize_custom_product_current_sync_date(self):
        """Verify product won't get synced immediately after adding association
        with a sync plan which has already been started

        @id: b56fccb9-8f84-4676-a777-b3c6458c909e

        @Assert: Repository was not synchronized

        @BZ: 1279539

        @CaseLevel: System
        """
        plan_name = gen_string('alpha')
        product = entities.Product(organization=self.organization).create()
        repo = entities.Repository(product=product).create()
        startdate = datetime.now()
        with Session(self.browser) as session:
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            self.syncplan.update(plan_name, add_products=[product.name])
            with self.assertRaises(AssertionError):
                self.validate_repo_content(
                    product.name,
                    repo.name,
                    ['errata', 'package_groups', 'packages'],
                    max_attempts=5,
                )
Example #5
0
    def test_positive_create_with_start_time(self):
        """Create Sync plan with specified start time

        :id: a4709229-325c-4027-b4dc-10a226c4d7bf

        :expectedresults: Sync Plan is created with the specified time.

        :BZ: 1460146

        :CaseLevel: Integration
        """
        plan_name = gen_string('alpha')
        with Session(self) as session:
            startdate = (self.get_client_datetime(session.browser)
                         + timedelta(minutes=10))
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            self.assertIsNotNone(self.syncplan.search(plan_name))
            self.syncplan.click(self.syncplan.search(plan_name))
            starttime_text = self.syncplan.wait_until_element(
                locators['sp.fetch_startdate']).text
            # Removed the seconds info as it would be too quick
            # to validate via UI.
            self.assertEqual(
                str(starttime_text).rpartition(':')[0],
                startdate.strftime("%Y/%m/%d %H:%M")
            )
Example #6
0
    def test_negative_synchronize_custom_product_current_sync_date(self):
        """Verify product won't get synced immediately after adding association
        with a sync plan which has already been started

        @Feature: Sync Plan

        @Assert: Repository was not synchronized

        @BZ: 1279539
        """
        plan_name = gen_string('alpha')
        product = entities.Product(organization=self.organization).create()
        repo = entities.Repository(product=product).create()
        startdate = datetime.now()
        with Session(self.browser) as session:
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            self.syncplan.update(
                plan_name, add_products=[product.name])
            with self.assertRaises(AssertionError):
                self.validate_repo_content(
                    product.name,
                    repo.name,
                    ['errata', 'package_groups', 'packages'],
                    max_attempts=5,
                )
Example #7
0
    def test_negative_synchronize_custom_product_past_sync_date(self):
        """Verify product won't get synced immediately after adding association
        with a sync plan which has already been started

        :id: b56fccb9-8f84-4676-a777-b3c6458c909e

        :expectedresults: Repository was not synchronized

        :BZ: 1279539

        :CaseLevel: System
        """
        plan_name = gen_string('alpha')
        product = entities.Product(organization=self.organization).create()
        repo = entities.Repository(product=product).create()
        with Session(self) as session:
            startdate = self.get_client_datetime(session.browser)
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                startdate=startdate.strftime('%Y-%m-%d'),
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            self.syncplan.update(
                plan_name, add_products=[product.name])
            with self.assertRaises(AssertionError):
                self.validate_task_status(repo.id, max_tries=2)
                self.validate_repo_content(
                    repo,
                    ['erratum', 'package', 'package_group'],
                    max_attempts=5,
                )
Example #8
0
    def test_positive_create_with_start_time(self):
        """Create Sync plan with specified start time

        @id: a4709229-325c-4027-b4dc-10a226c4d7bf

        @Assert: Sync Plan is created with the specified time.

        @CaseLevel: Integration
        """
        plan_name = gen_string('alpha')
        startdate = self.get_client_datetime() + timedelta(minutes=10)
        with Session(self.browser) as session:
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            self.assertIsNotNone(self.syncplan.search(plan_name))
            self.syncplan.click(self.syncplan.search(plan_name))
            starttime_text = self.syncplan.wait_until_element(
                locators['sp.fetch_startdate']).text
            # Removed the seconds info as it would be too quick
            # to validate via UI.
            self.assertEqual(
                str(starttime_text).rpartition(':')[0],
                startdate.strftime("%Y/%m/%d %H:%M"))
Example #9
0
    def test_positive_create_with_start_date(self):
        """Create Sync plan with specified start date

        @Feature: Content Sync Plan - Positive Create

        @Assert: Sync Plan is created with the specified date
        """
        plan_name = gen_string('alpha')
        startdate = datetime.now() + timedelta(days=10)
        startdate_str = startdate.strftime("%Y-%m-%d")
        current_date_time = startdate.strftime("%b %-d, %Y %I:%M:%S %p")
        # validating only for date
        fetch_startdate = current_date_time.rpartition(',')[0]
        with Session(self.browser) as session:
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start date',
                startdate=startdate_str,
            )
            self.assertIsNotNone(self.syncplan.search(plan_name))
            self.syncplan.search(plan_name).click()
            self.syncplan.wait_for_ajax()
            startdate_text = self.syncplan.wait_until_element(
                locators['sp.fetch_startdate']).text
            saved_startdate = str(startdate_text).rpartition(',')[0]
            self.assertEqual(saved_startdate, fetch_startdate)
Example #10
0
    def test_positive_create_with_start_date(self):
        """Create Sync plan with specified start date

        @id: 020b3aff-7216-4ad6-b95e-8ffaf68cba20

        @Assert: Sync Plan is created with the specified date

        @CaseLevel: Integration
        """
        plan_name = gen_string('alpha')
        startdate = self.get_client_datetime() + timedelta(days=10)
        with Session(self.browser) as session:
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start date',
                startdate=startdate.strftime("%Y-%m-%d"),
            )
            self.assertIsNotNone(self.syncplan.search(plan_name))
            self.syncplan.click(self.syncplan.search(plan_name))
            startdate_text = self.syncplan.wait_until_element(
                locators['sp.fetch_startdate']).text
            self.assertEqual(
                str(startdate_text).partition(' ')[0],
                startdate.strftime("%Y/%m/%d"))
Example #11
0
    def test_positive_create_with_start_time(self):
        """Create Sync plan with specified start time

        @Feature: Content Sync Plan - Positive Create

        @Assert: Sync Plan is created with the specified time.
        """
        plan_name = gen_string('alpha')
        startdate = datetime.now() + timedelta(minutes=10)
        # Formatting current_date to web-UI format "%b %d, %Y %I:%M:%S %p" and
        # removed zero-padded date(%-d) and hrs(%l) as fetching via web-UI
        # doesn't have it
        formatted_date_time = startdate.strftime("%b %-d, %Y %-l:%M:%S %p")
        # Removed the seconds info as it would be too quick to validate via UI.
        starttime = formatted_date_time.rpartition(':')[0]
        with Session(self.browser) as session:
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            self.assertIsNotNone(self.syncplan.search(plan_name))
            self.syncplan.search(plan_name).click()
            self.syncplan.wait_for_ajax()
            starttime_text = self.syncplan.wait_until_element(
                locators['sp.fetch_startdate']).text
            # Removed the seconds info as it would be too quick
            # to validate via UI.
            saved_starttime = str(starttime_text).rpartition(':')[0]
            self.assertEqual(saved_starttime, starttime)
Example #12
0
    def test_positive_create_2(self):
        """@Test: Create Sync plan with specified start time

        @Feature: Content Sync Plan - Positive Create

        @Assert: Sync Plan is created with the specified time.

        @BZ: 1131661

        """
        locator = locators["sp.fetch_startdate"]
        plan_name = gen_string("alpha", 8)
        description = "sync plan create with start date"
        current_date = datetime.now()
        startdate = current_date + timedelta(minutes=10)
        starthour = startdate.strftime("%H")
        startminute = startdate.strftime("%M")
        # Formatting current_date to web-UI format "%b %d, %Y %I:%M:%S %p" and
        # removed zero-padded date(%-d) and hrs(%l) as fetching via web-UI
        # doesn't have it
        formatted_date_time = startdate.strftime("%b %-d, %Y %l:%M:%S %p")
        # Removed the seconds info as it would be too quick to validate via UI.
        starttime = formatted_date_time.rpartition(':')[0]
        with Session(self.browser) as session:
            make_syncplan(session, org=self.org_name, name=plan_name,
                          description=description, start_hour=starthour,
                          start_minute=startminute)
            self.assertIsNotNone(self.syncplan.search(plan_name))
            self.syncplan.search(plan_name).click()
            self.syncplan.wait_for_ajax()
            starttime_text = self.syncplan.wait_until_element(locator).text
            # Removed the seconds info as it would be too quick
            # to validate via UI.
            saved_starttime = str(starttime_text).rpartition(':')[0]
            self.assertEqual(saved_starttime, starttime)
Example #13
0
    def test_positive_synchronize_rh_product_current_sync_date(self):
        """Create a sync plan with current datetime as a sync date, add a
        RH product and verify the product gets synchronized on the next sync
        occurrence

        @id: 73a456fb-ad17-4921-b57c-27fc8e432a83

        @Assert: Product is synchronized successfully.

        @BZ: 1279539

        @CaseLevel: System
        """
        interval = 60 * 60  # 'hourly' sync interval in seconds
        plan_name = gen_string('alpha')
        org = entities.Organization().create()
        with manifests.clone() as manifest:
            entities.Subscription().upload(
                data={'organization_id': org.id},
                files={'content': manifest.content},
            )
        repo_id = enable_rhrepo_and_fetchid(
            basearch='x86_64',
            org_id=org.id,
            product=PRDS['rhel'],
            repo=REPOS['rhst7']['name'],
            reposet=REPOSET['rhst7'],
            releasever=None,
        )
        repo = entities.Repository(id=repo_id).read()
        startdate = self.get_client_datetime()
        with Session(self.browser) as session:
            make_syncplan(
                session,
                org=org.name,
                name=plan_name,
                description='sync plan create with start time',
                interval=u'hourly',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            # Associate sync plan with product
            self.syncplan.update(plan_name, add_products=[PRDS['rhel']])
            # Wait half of expected time
            sleep(interval / 2)
            # Verify product has not been synced yet
            self.validate_repo_content(
                PRDS['rhel'],
                repo.name,
                ['errata', 'package_groups', 'packages'],
                after_sync=False,
            )
            # Wait the rest of expected time
            sleep(interval / 2)
            # Verify product was synced successfully
            self.validate_repo_content(
                PRDS['rhel'],
                repo.name,
                ['errata', 'package_groups', 'packages'],
            )
Example #14
0
    def test_positive_create_3(self):
        """@Test: Create Sync plan with specified start date

        @Feature: Content Sync Plan - Positive Create

        @Assert: Sync Plan is created with the specified date

        @BZ: 1131661

        """
        locator = locators["sp.fetch_startdate"]
        plan_name = gen_string("alpha", 8)
        description = "sync plan create with start date"
        current_date = datetime.now()
        startdate = current_date + timedelta(days=10)
        startdate_str = startdate.strftime("%Y-%m-%d")
        current_date_time = startdate.strftime("%b %-d, %Y %I:%M:%S %p")
        # validating only for date
        fetch_startdate = current_date_time.rpartition(',')[0]
        with Session(self.browser) as session:
            make_syncplan(session, org=self.org_name, name=plan_name,
                          description=description, startdate=startdate_str)
            self.assertIsNotNone(self.syncplan.search(plan_name))
            self.syncplan.search(plan_name).click()
            self.syncplan.wait_for_ajax()
            startdate_text = self.syncplan.wait_until_element(locator).text
            saved_startdate = str(startdate_text).rpartition(',')[0]
            self.assertEqual(saved_startdate, fetch_startdate)
Example #15
0
    def test_positive_synchronize_custom_products_future_sync_date(self):
        """Create a sync plan with sync date in a future and sync multiple
        custom products with multiple repos automatically.

        @Assert: Products are synchronized successfully.

        @Feature: SyncPlan
        """
        delay = 10 * 60  # delay for sync date in seconds
        plan_name = gen_string('alpha')
        products = [
            entities.Product(organization=self.organization).create()
            for _ in range(randint(3, 5))
        ]
        repos = [
            entities.Repository(product=product).create()
            for product in products
            for _ in range(randint(2, 3))
        ]
        startdate = datetime.now() + timedelta(seconds=delay)
        with Session(self.browser) as session:
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            #  Verify products have not been synced yet
            for repo in repos:
                self.validate_repo_content(
                    repo.product.read().name,
                    repo.name,
                    ['errata', 'package_groups', 'packages'],
                    after_sync=False,
                )
            # Associate sync plan with products
            self.syncplan.update(
                plan_name, add_products=[product.name for product in products])
            # Wait half of expected time
            sleep(delay/2)
            # Verify products has not been synced yet
            for repo in repos:
                self.validate_repo_content(
                    repo.product.read().name,
                    repo.name,
                    ['errata', 'package_groups', 'packages'],
                    after_sync=False,
                )
            # Wait the rest of expected time
            sleep(delay/2)
            # Verify product was synced successfully
            for repo in repos:
                self.validate_repo_content(
                    repo.product.read().name,
                    repo.name,
                    ['errata', 'package_groups', 'packages'],
                )
Example #16
0
    def test_positive_synchronize_custom_products_future_sync_date(self):
        """Create a sync plan with sync date in a future and sync multiple
        custom products with multiple repos automatically.

        :id: 9564e726-59c6-4d24-bb3d-f0ab3c4b26a5

        :expectedresults: Products are synchronized successfully.

        :CaseLevel: System
        """
        delay = 5 * 60  # delay for sync date in seconds
        plan_name = gen_string('alpha')
        products = [
            entities.Product(organization=self.organization).create()
            for _ in range(3)
        ]
        repos = [
            entities.Repository(product=product).create()
            for product in products
            for _ in range(2)
        ]
        with Session(self) as session:
            startdate = (self.get_client_datetime(session.browser)
                         + timedelta(seconds=delay))
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            #  Verify products have not been synced yet
            for repo in repos:
                with self.assertRaises(AssertionError):
                    self.validate_task_status(repo.id, max_tries=2)
            # Associate sync plan with products
            self.syncplan.update(
                plan_name, add_products=[product.name for product in products])
            # Wait third part of expected time, because it will take a while to
            # verify each product and repository
            self.logger.info('Waiting {0} seconds to check products'
                             ' were not synced'.format(delay/3))
            sleep(delay / 4)
            # Verify products has not been synced yet
            for repo in repos:
                with self.assertRaises(AssertionError):
                    self.validate_task_status(repo.id, max_tries=2)
            # Wait the rest of expected time
            self.logger.info('Waiting {0} seconds to check products'
                             ' were synced'.format(delay*2/3))
            sleep(delay * 3/4)
            # Verify product was synced successfully
            self.validate_task_status(repo.id)
            for repo in repos:
                self.validate_repo_content(
                    repo,
                    ['erratum', 'package', 'package_group'],
                )
Example #17
0
    def test_positive_synchronize_rh_product_current_sync_date(self):
        """Create a sync plan with current datetime as a sync date, add a
        RH product and verify the product gets synchronized on the next sync
        occurrence

        @Assert: Product is synchronized successfully.

        @Feature: SyncPlan

        @BZ: 1279539
        """
        interval = 60 * 60  # 'hourly' sync interval in seconds
        plan_name = gen_string('alpha')
        org = entities.Organization().create()
        with manifests.clone() as manifest:
            entities.Subscription().upload(
                data={'organization_id': org.id},
                files={'content': manifest.content},
            )
        repo_id = enable_rhrepo_and_fetchid(
            basearch='x86_64',
            org_id=org.id,
            product=PRDS['rhel'],
            repo=REPOS['rhst7']['name'],
            reposet=REPOSET['rhst7'],
            releasever=None,
        )
        repo = entities.Repository(id=repo_id).read()
        startdate = datetime.now()
        with Session(self.browser) as session:
            make_syncplan(
                session,
                org=org.name,
                name=plan_name,
                description='sync plan create with start time',
                interval=u'hourly',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            # Associate sync plan with product
            self.syncplan.update(
                plan_name, add_products=[PRDS['rhel']])
            # Wait half of expected time
            sleep(interval / 2)
            # Verify product has not been synced yet
            self.validate_repo_content(
                PRDS['rhel'],
                repo.name,
                ['errata', 'package_groups', 'packages'],
                after_sync=False,
            )
            # Wait the rest of expected time
            sleep(interval / 2)
            # Verify product was synced successfully
            self.validate_repo_content(
                PRDS['rhel'],
                repo.name,
                ['errata', 'package_groups', 'packages'],
            )
Example #18
0
    def test_positive_synchronize_custom_products_future_sync_date(self):
        """Create a sync plan with sync date in a future and sync multiple
        custom products with multiple repos automatically.

        :id: 9564e726-59c6-4d24-bb3d-f0ab3c4b26a5

        :expectedresults: Products are synchronized successfully.

        :CaseLevel: System
        """
        delay = 5 * 60  # delay for sync date in seconds
        plan_name = gen_string('alpha')
        products = [
            entities.Product(organization=self.organization).create()
            for _ in range(3)
        ]
        repos = [
            entities.Repository(product=product).create()
            for product in products
            for _ in range(2)
        ]
        with Session(self) as session:
            startdate = (self.get_client_datetime(session.browser)
                         + timedelta(seconds=delay))
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            #  Verify products have not been synced yet
            for repo in repos:
                with self.assertRaises(AssertionError):
                    self.validate_task_status(repo.id, max_tries=2)
            # Associate sync plan with products
            self.syncplan.update(
                plan_name, add_products=[product.name for product in products])
            # Wait third part of expected time, because it will take a while to
            # verify each product and repository
            self.logger.info('Waiting {0} seconds to check products'
                             ' were not synced'.format(delay/3))
            sleep(delay / 4)
            # Verify products has not been synced yet
            for repo in repos:
                with self.assertRaises(AssertionError):
                    self.validate_task_status(repo.id, max_tries=2)
            # Wait the rest of expected time
            self.logger.info('Waiting {0} seconds to check products'
                             ' were synced'.format(delay*2/3))
            sleep(delay * 3/4)
            # Verify product was synced successfully
            self.validate_task_status(repo.id)
            for repo in repos:
                self.validate_repo_content(
                    repo,
                    ['erratum', 'package', 'package_group'],
                )
Example #19
0
    def test_positive_synchronize_custom_product_future_sync_date(self):
        """Create a sync plan with sync date in a future and sync one custom
        product with it automatically.

        :id: fdd3b2a2-8d8e-4a18-b6a5-363e8dd5f998

        :expectedresults: Product is synchronized successfully.

        :CaseLevel: System
        """
        delay = 5 * 60  # delay for sync date in seconds
        plan_name = gen_string('alpha')
        product = entities.Product(organization=self.organization).create()
        repo = entities.Repository(product=product).create()
        with Session(self) as session:
            startdate = (self.get_client_datetime(session.browser)
                         + timedelta(seconds=delay))
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            # Verify product is not synced and doesn't have any content
            with self.assertRaises(AssertionError):
                self.validate_task_status(repo.id, max_tries=2)
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
                after_sync=False,
            )
            # Associate sync plan with product
            self.syncplan.update(plan_name, add_products=[product.name])
            # Wait half of expected time
            self.logger.info('Waiting {0} seconds to check product {1}'
                             ' was not synced'.format(delay/2, product.name))
            sleep(delay / 4)
            # Verify product has not been synced yet
            with self.assertRaises(AssertionError):
                self.validate_task_status(repo.id, max_tries=2)
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
                after_sync=False,
            )
            # Wait the rest of expected time
            self.logger.info('Waiting {0} seconds to check product {1}'
                             ' was synced'.format(delay/2, product.name))
            sleep(delay * 3/4)
            # Verify product was synced successfully
            self.validate_task_status(repo.id,
                                      repo_backend_id=repo.backend_identifier
                                      )
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
            )
Example #20
0
    def test_positive_synchronize_rh_product_future_sync_date(self):
        """Create a sync plan with sync date in a future and sync one RH
        product with it automatically.

        @id: 193d0159-d4a7-4f50-b037-7289f4576ade

        @Assert: Product is synchronized successfully.

        @CaseLevel: System
        """
        delay = 10 * 60  # delay for sync date in seconds
        plan_name = gen_string('alpha')
        org = entities.Organization().create()
        with manifests.clone() as manifest:
            entities.Subscription().upload(
                data={'organization_id': org.id},
                files={'content': manifest.content},
            )
        repo_id = enable_rhrepo_and_fetchid(
            basearch='x86_64',
            org_id=org.id,
            product=PRDS['rhel'],
            repo=REPOS['rhst7']['name'],
            reposet=REPOSET['rhst7'],
            releasever=None,
        )
        repo = entities.Repository(id=repo_id).read()
        startdate = datetime.now() + timedelta(seconds=delay)
        with Session(self.browser) as session:
            make_syncplan(
                session,
                org=org.name,
                name=plan_name,
                description='sync plan create with start time',
                interval=u'hourly',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            # Associate sync plan with product
            self.syncplan.update(
                plan_name, add_products=[PRDS['rhel']])
            # Wait half of expected time
            sleep(delay / 2)
            # Verify product has not been synced yet
            self.validate_repo_content(
                PRDS['rhel'],
                repo.name,
                ['errata', 'package_groups', 'packages'],
                after_sync=False,
            )
            # Wait the rest of expected time
            sleep(delay / 2)
            # Verify product was synced successfully
            self.validate_repo_content(
                PRDS['rhel'],
                repo.name,
                ['errata', 'package_groups', 'packages'],
            )
Example #21
0
    def test_positive_synchronize_rh_product_future_sync_date(self):
        """Create a sync plan with sync date in a future and sync one RH
        product with it automatically.

        :id: 193d0159-d4a7-4f50-b037-7289f4576ade

        :expectedresults: Product is synchronized successfully.

        :CaseLevel: System
        """
        delay = 10 * 60  # delay for sync date in seconds
        plan_name = gen_string('alpha')
        org = entities.Organization().create()
        with manifests.clone() as manifest:
            entities.Subscription().upload(
                data={'organization_id': org.id},
                files={'content': manifest.content},
            )
        repo_id = enable_rhrepo_and_fetchid(
            basearch='x86_64',
            org_id=org.id,
            product=PRDS['rhel'],
            repo=REPOS['rhst7']['name'],
            reposet=REPOSET['rhst7'],
            releasever=None,
        )
        repo = entities.Repository(id=repo_id).read()
        with Session(self) as session:
            startdate = (self.get_client_datetime(session.browser) +
                         timedelta(seconds=delay))
            make_syncplan(
                session,
                org=org.name,
                name=plan_name,
                description='sync plan create with start time',
                interval=u'hourly',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            # Associate sync plan with product
            self.syncplan.update(plan_name, add_products=[PRDS['rhel']])
            # Wait half of expected time
            sleep(delay / 2)
            # Verify product has not been synced yet
            self.validate_repo_content(
                PRDS['rhel'],
                repo.name,
                ['errata', 'package_groups', 'packages'],
                after_sync=False,
            )
            # Wait the rest of expected time
            sleep(delay / 2)
            # Verify product was synced successfully
            self.validate_repo_content(
                PRDS['rhel'],
                repo.name,
                ['errata', 'package_groups', 'packages'],
            )
Example #22
0
    def test_positive_synchronize_custom_product_future_sync_date(self):
        """Create a sync plan with sync date in a future and sync one custom
        product with it automatically.

        :id: fdd3b2a2-8d8e-4a18-b6a5-363e8dd5f998

        :expectedresults: Product is synchronized successfully.

        :CaseLevel: System
        """
        delay = 5 * 60  # delay for sync date in seconds
        plan_name = gen_string('alpha')
        product = entities.Product(organization=self.organization).create()
        repo = entities.Repository(product=product).create()
        with Session(self) as session:
            startdate = (self.get_client_datetime(session.browser)
                         + timedelta(seconds=delay))
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            # Verify product is not synced and doesn't have any content
            with self.assertRaises(AssertionError):
                self.validate_task_status(repo.id, max_tries=2)
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
                after_sync=False,
            )
            # Associate sync plan with product
            self.syncplan.update(plan_name, add_products=[product.name])
            # Wait half of expected time
            self.logger.info('Waiting {0} seconds to check product {1}'
                             ' was not synced'.format(delay/2, product.name))
            sleep(delay / 4)
            # Verify product has not been synced yet
            with self.assertRaises(AssertionError):
                self.validate_task_status(repo.id, max_tries=2)
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
                after_sync=False,
            )
            # Wait the rest of expected time
            self.logger.info('Waiting {0} seconds to check product {1}'
                             ' was synced'.format(delay/2, product.name))
            sleep(delay * 3/4)
            # Verify product was synced successfully
            self.validate_task_status(repo.id)
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
            )
Example #23
0
    def test_positive_synchronize_custom_product_past_sync_date(self):
        """Create a sync plan with past datetime as a sync date, add a
        custom product and verify the product gets synchronized on the next
        sync occurrence

        :id: d65e91c4-a0b6-4588-a3ff-fe9cd3762556

        :expectedresults: Product is synchronized successfully.

        :BZ: 1279539

        :CaseLevel: System
        """
        interval = 60 * 60  # 'hourly' sync interval in seconds
        delay = 5 * 60
        plan_name = gen_string('alpha')
        product = entities.Product(organization=self.organization).create()
        repo = entities.Repository(product=product).create()
        with Session(self) as session:
            startdate = (self.get_client_datetime(session.browser)
                         - timedelta(seconds=(interval - delay)))
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                startdate=startdate.strftime('%Y-%m-%d'),
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
                sync_interval='hourly',
            )
            # Associate sync plan with product
            self.syncplan.update(
                plan_name, add_products=[product.name])
            # Verify product has not been synced yet
            self.logger.info('Waiting {0} seconds to check product {1}'
                             ' was not synced'.format(delay/4, product.name))
            sleep(delay/4)
            with self.assertRaises(AssertionError):
                self.validate_task_status(repo.id, max_tries=2)
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
                after_sync=False,
            )
            # Wait until the next recurrence
            self.logger.info('Waiting {0} seconds to check product {1}'
                             ' was synced'.format(delay, product.name))
            sleep(delay * 3/4)
            # Verify product was synced successfully
            self.validate_task_status(repo.id,
                                      repo_backend_id=repo.backend_identifier
                                      )
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
            )
Example #24
0
    def test_positive_synchronize_custom_product_past_sync_date(self):
        """Create a sync plan with past datetime as a sync date, add a
        custom product and verify the product gets synchronized on the next
        sync occurrence

        :id: d65e91c4-a0b6-4588-a3ff-fe9cd3762556

        :expectedresults: Product is synchronized successfully.

        :BZ: 1279539

        :CaseLevel: System
        """
        interval = 60 * 60  # 'hourly' sync interval in seconds
        delay = 5 * 60
        plan_name = gen_string('alpha')
        product = entities.Product(organization=self.organization).create()
        repo = entities.Repository(product=product).create()
        with Session(self) as session:
            startdate = (self.get_client_datetime(session.browser)
                         - timedelta(seconds=(interval - delay)))
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                startdate=startdate.strftime('%Y-%m-%d'),
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
                sync_interval='hourly',
            )
            # Associate sync plan with product
            self.syncplan.update(
                plan_name, add_products=[product.name])
            # Verify product has not been synced yet
            self.logger.info('Waiting {0} seconds to check product {1}'
                             ' was not synced'.format(delay/4, product.name))
            sleep(delay/4)
            with self.assertRaises(AssertionError):
                self.validate_task_status(repo.id, max_tries=2)
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
                after_sync=False,
            )
            # Wait until the next recurrence
            self.logger.info('Waiting {0} seconds to check product {1}'
                             ' was synced'.format(delay, product.name))
            sleep(delay * 3/4)
            # Verify product was synced successfully
            self.validate_task_status(repo.id)
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
            )
Example #25
0
    def test_positive_synchronize_custom_product_weekly_recurrence(self):
        """Create a daily sync plan with past datetime as a sync date,
        add a custom product and verify the product gets synchronized
        on the next sync occurrence

        :id: eb92b785-384a-4d0d-b8c2-6c900ed8b87e

        :expectedresults: Product is synchronized successfully.

        :BZ: 1396647, 1498793

        :CaseLevel: System
        """
        delay = 5 * 60
        plan_name = gen_string('alpha')
        product = entities.Product(organization=self.organization).create()
        repo = entities.Repository(product=product).create()
        with Session(self) as session:
            startdate = (self.get_client_datetime(session.browser)
                         - timedelta(weeks=1) + timedelta(seconds=delay))
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                startdate=startdate.strftime('%Y-%m-%d'),
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
                sync_interval='weekly',
            )
            # Associate sync plan with product
            self.syncplan.update(
                plan_name, add_products=[product.name])
            # Verify product has not been synced yet
            self.logger.info('Waiting {0} seconds to check product {1}'
                             ' was not synced'.format(delay/4, product.name))
            sleep(delay/4)
            with self.assertRaises(AssertionError):
                self.validate_task_status(repo.id, max_tries=2)
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
                after_sync=False,
            )
            # Wait until the next recurrence
            self.logger.info('Waiting {0} seconds to check product {1}'
                             ' was synced'.format(delay, product.name))
            sleep(delay * 3/4)
            # Verify product was synced successfully
            self.validate_task_status(repo.id)
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
            )
Example #26
0
    def test_negative_create_1(self, name):
        """@Test: Create Sync Plan with blank and whitespace in name

        @Feature: Content Sync Plan - Negative Create

        @Assert: Sync Plan is not created
        """
        locator = common_locators["common_invalid"]
        with Session(self.browser) as session:
            make_syncplan(session, org=self.org_name, name=name,
                          submit_validate=False)
            invalid = self.syncplan.wait_until_element(locator)
            self.assertIsNotNone(invalid)
Example #27
0
    def test_positive_synchronize_custom_product_future_sync_date(self):
        """Create a sync plan with sync date in a future and sync one custom
        product with it automatically.

        :id: fdd3b2a2-8d8e-4a18-b6a5-363e8dd5f998

        :expectedresults: Product is synchronized successfully.

        :CaseLevel: System
        """
        delay = 10 * 60  # delay for sync date in seconds
        plan_name = gen_string('alpha')
        product = entities.Product(organization=self.organization).create()
        repo = entities.Repository(product=product).create()
        with Session(self) as session:
            startdate = (self.get_client_datetime(session.browser) +
                         timedelta(seconds=delay))
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            # Verify product is not synced and doesn't have any content
            self.validate_repo_content(
                product.name,
                repo.name,
                ['errata', 'package_groups', 'packages'],
                after_sync=False,
            )
            # Associate sync plan with product
            self.syncplan.update(plan_name, add_products=[product.name])
            # Wait half of expected time
            sleep(delay / 2)
            # Verify product has not been synced yet
            self.validate_repo_content(
                product.name,
                repo.name,
                ['errata', 'package_groups', 'packages'],
                after_sync=False,
            )
            # Wait the rest of expected time
            sleep(delay / 2)
            # Verify product was synced successfully
            self.validate_repo_content(
                product.name,
                repo.name,
                ['errata', 'package_groups', 'packages'],
            )
Example #28
0
    def test_positive_create_1(self, test_data):
        """@Test: Create Sync Plan with minimal input parameters

        @Feature: Content Sync Plan - Positive Create

        @Assert: Sync Plan is created

        """
        with Session(self.browser) as session:
            make_syncplan(session, org=self.org_name,
                          name=test_data['name'],
                          description=test_data['desc'],
                          sync_interval=test_data['interval'])
            self.assertIsNotNone(self.syncplan.search(test_data['name']))
Example #29
0
    def test_positive_synchronize_custom_product_future_sync_date(self):
        """Create a sync plan with sync date in a future and sync one custom
        product with it automatically.

        @id: fdd3b2a2-8d8e-4a18-b6a5-363e8dd5f998

        @Assert: Product is synchronized successfully.

        @CaseLevel: System
        """
        delay = 10 * 60  # delay for sync date in seconds
        plan_name = gen_string('alpha')
        product = entities.Product(organization=self.organization).create()
        repo = entities.Repository(product=product).create()
        startdate = datetime.now() + timedelta(seconds=delay)
        with Session(self.browser) as session:
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            # Verify product is not synced and doesn't have any content
            self.validate_repo_content(
                product.name,
                repo.name,
                ['errata', 'package_groups', 'packages'],
                after_sync=False,
            )
            # Associate sync plan with product
            self.syncplan.update(plan_name, add_products=[product.name])
            # Wait half of expected time
            sleep(delay/2)
            # Verify product has not been synced yet
            self.validate_repo_content(
                product.name,
                repo.name,
                ['errata', 'package_groups', 'packages'],
                after_sync=False,
            )
            # Wait the rest of expected time
            sleep(delay/2)
            # Verify product was synced successfully
            self.validate_repo_content(
                product.name,
                repo.name,
                ['errata', 'package_groups', 'packages'],
            )
Example #30
0
    def test_negative_create_2(self, name):
        """@Test: Create Sync Plan with 256 characters in name

        @Feature: Content Sync Plan - Negative Create

        @Assert: Sync Plan is not created with more than 255 chars

        """
        description = 'more than 255 chars'
        with Session(self.browser) as session:
            make_syncplan(session, org=self.org_name, name=name,
                          description=description, submit_validate=False)
            self.assertIsNotNone(self.syncplan.wait_until_element(
                common_locators['common_invalid']))
Example #31
0
    def test_positive_synchronize_custom_product_past_sync_date(self):
        """Create a sync plan with past datetime as a sync date, add a
        custom product and verify the product gets synchronized on the next
        sync occurrence

        :id: d65e91c4-a0b6-4588-a3ff-fe9cd3762556

        :expectedresults: Product is synchronized successfully.

        :BZ: 1279539

        :CaseLevel: System
        """
        interval = 60 * 60  # 'hourly' sync interval in seconds
        delay = 80
        plan_name = gen_string('alpha')
        product = entities.Product(organization=self.organization).create()
        repo = entities.Repository(product=product).create()
        with Session(self) as session:
            startdate = (self.get_client_datetime(session.browser) -
                         timedelta(seconds=(interval - delay / 2)))
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                startdate=startdate.strftime('%Y-%m-%d'),
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
                sync_interval='hourly',
            )
            # Associate sync plan with product
            self.syncplan.update(plan_name, add_products=[product.name])
            # Verify product has not been synced yet
            sleep(delay / 4)
            self.validate_repo_content(
                product.name,
                repo.name,
                ['errata', 'package_groups', 'packages'],
                after_sync=False,
            )
            # Wait until the next recurrence
            sleep(delay)
            # Verify product was synced successfully
            self.validate_repo_content(
                product.name,
                repo.name,
                ['errata', 'package_groups', 'packages'],
            )
Example #32
0
    def test_positive_synchronize_custom_product_weekly_recurrence(self):
        """Create a daily sync plan with past datetime as a sync date,
        add a custom product and verify the product gets synchronized
        on the next sync occurrence

        :id: eb92b785-384a-4d0d-b8c2-6c900ed8b87e

        :expectedresults: Product is synchronized successfully.

        :BZ: 1396647

        :CaseLevel: System
        """
        delay = 300
        plan_name = gen_string('alpha')
        product = entities.Product(organization=self.organization).create()
        repo = entities.Repository(product=product).create()
        with Session(self) as session:
            startdate = (self.get_client_datetime(session.browser) -
                         timedelta(weeks=1) + timedelta(seconds=delay / 2))
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                startdate=startdate.strftime('%Y-%m-%d'),
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
                sync_interval='weekly',
            )
            # Associate sync plan with product
            self.syncplan.update(plan_name, add_products=[product.name])
            # Verify product has not been synced yet
            sleep(delay / 4)
            self.validate_repo_content(
                product.name,
                repo.name,
                ['errata', 'package_groups', 'packages'],
                after_sync=False,
            )
            # Wait until the next recurrence
            sleep(delay)
            # Verify product was synced successfully
            self.validate_repo_content(
                product.name,
                repo.name,
                ['errata', 'package_groups', 'packages'],
            )
Example #33
0
    def test_negative_create_3(self, name):
        """@Test: Create Sync Plan with an existing name

        @Feature: Content Sync Plan - Positive Create

        @Assert: Sync Plan cannot be created with existing name

        """
        description = 'with same name'
        with Session(self.browser) as session:
            make_syncplan(session, org=self.org_name, name=name)
            self.assertIsNotNone(self.syncplan.search(name))
            make_syncplan(session, org=self.org_name, name=name,
                          description=description, submit_validate=False)
            self.assertIsNotNone(self.syncplan.wait_until_element(
                common_locators['common_invalid']))
Example #34
0
    def test_positive_synchronize_custom_product_current_sync_date(self):
        """Create a sync plan with current datetime as a sync date, add a
        custom product and verify the product gets synchronized on the next
        sync occurrence

        @id: d65e91c4-a0b6-4588-a3ff-fe9cd3762556

        @Assert: Product is synchronized successfully.

        @BZ: 1279539

        @CaseLevel: System
        """
        interval = 60 * 60  # 'hourly' sync interval in seconds
        plan_name = gen_string('alpha')
        product = entities.Product(organization=self.organization).create()
        repo = entities.Repository(product=product).create()
        startdate = datetime.now()
        with Session(self.browser) as session:
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
                sync_interval='hourly',
            )
            # Associate sync plan with product
            self.syncplan.update(
                plan_name, add_products=[product.name])
            # Wait half of expected time
            sleep(interval / 2)
            # Verify product has not been synced yet
            self.validate_repo_content(
                product.name, repo.name,
                ['errata', 'package_groups', 'packages'],
                after_sync=False,
            )
            # Wait the rest of expected time
            sleep(interval / 2)
            # Verify product was synced successfully
            self.validate_repo_content(
                product.name,
                repo.name,
                ['errata', 'package_groups', 'packages'],
            )
Example #35
0
    def test_positive_synchronize_custom_product_current_sync_date(self):
        """Create a sync plan with current datetime as a sync date, add a
        custom product and verify the product gets synchronized on the next
        sync occurrence

        @id: d65e91c4-a0b6-4588-a3ff-fe9cd3762556

        @Assert: Product is synchronized successfully.

        @BZ: 1279539

        @CaseLevel: System
        """
        interval = 60 * 60  # 'hourly' sync interval in seconds
        plan_name = gen_string('alpha')
        product = entities.Product(organization=self.organization).create()
        repo = entities.Repository(product=product).create()
        startdate = datetime.now()
        with Session(self.browser) as session:
            make_syncplan(
                session,
                org=self.organization.name,
                name=plan_name,
                description='sync plan create with start time',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
                sync_interval='hourly',
            )
            # Associate sync plan with product
            self.syncplan.update(plan_name, add_products=[product.name])
            # Wait half of expected time
            sleep(interval / 2)
            # Verify product has not been synced yet
            self.validate_repo_content(
                product.name,
                repo.name,
                ['errata', 'package_groups', 'packages'],
                after_sync=False,
            )
            # Wait the rest of expected time
            sleep(interval / 2)
            # Verify product was synced successfully
            self.validate_repo_content(
                product.name,
                repo.name,
                ['errata', 'package_groups', 'packages'],
            )
Example #36
0
    def test_negative_create_2(self, name):
        """@Test: Create Sync Plan with 256 characters in name

        @Feature: Content Sync Plan - Negative Create

        @Assert: Sync Plan is not created with more than 255 chars

        @BZ: 1087425

        """
        locator = common_locators["common_haserror"]
        description = "more than 255 chars"
        with Session(self.browser) as session:
            make_syncplan(session, org=self.org_name, name=name,
                          description=description, submit_validate=False)
            error = self.syncplan.wait_until_element(locator)
            self.assertIsNotNone(error)
Example #37
0
    def test_positive_create_with_name(self):
        """Create Sync Plan with valid name values

        @id: ceb125a4-449a-4a86-a94f-2a28884e3a41

        @Assert: Sync Plan is created
        """
        with Session(self.browser) as session:
            for name in generate_strings_list():
                with self.subTest(name):
                    make_syncplan(
                        session,
                        org=self.organization.name,
                        name=name,
                        description=gen_string('utf8'),
                        sync_interval=choice(valid_sync_intervals()),
                    )
                    self.assertIsNotNone(self.syncplan.search(name))
Example #38
0
    def test_positive_create_with_name(self):
        """Create Sync Plan with valid name values

        @id: ceb125a4-449a-4a86-a94f-2a28884e3a41

        @Assert: Sync Plan is created
        """
        with Session(self.browser) as session:
            for name in generate_strings_list():
                with self.subTest(name):
                    make_syncplan(
                        session,
                        org=self.organization.name,
                        name=name,
                        description=gen_string('utf8'),
                        sync_interval=choice(valid_sync_intervals()),
                    )
                    self.assertIsNotNone(self.syncplan.search(name))
    def test_positive_create_with_name(self):
        """Create Sync Plan with valid name values

        @Feature: Content Sync Plan - Positive Create

        @Assert: Sync Plan is created
        """
        with Session(self.browser) as session:
            for name in generate_strings_list():
                with self.subTest(name):
                    make_syncplan(
                        session,
                        org=self.organization.name,
                        name=name,
                        description=gen_string('utf8'),
                        sync_interval=valid_sync_intervals()[randint(0, 2)],
                    )
                    self.assertIsNotNone(self.syncplan.search(name))
Example #40
0
    def test_positive_create_with_name(self):
        """Create Sync Plan with valid name values

        @Feature: Content Sync Plan - Positive Create

        @Assert: Sync Plan is created
        """
        with Session(self.browser) as session:
            for name in generate_strings_list():
                with self.subTest(name):
                    make_syncplan(
                        session,
                        org=self.organization.name,
                        name=name,
                        description=gen_string('utf8'),
                        sync_interval=valid_sync_intervals()[randint(0, 2)],
                    )
                    self.assertIsNotNone(self.syncplan.search(name))
Example #41
0
    def test_negative_create_with_invalid_name(self):
        """Create Sync Plan with invalid names

        @Feature: Content Sync Plan - Negative Create

        @Assert: Sync Plan is not created
        """
        with Session(self.browser) as session:
            for name in invalid_values_list(interface='ui'):
                with self.subTest(name):
                    make_syncplan(
                        session,
                        org=self.organization.name,
                        name=name,
                        description='invalid name',
                    )
                    self.assertIsNotNone(self.syncplan.wait_until_element(
                        common_locators['common_invalid']))
    def test_positive_create_with_sync_interval(self):
        """Create Sync Plan with valid sync intervals

        @Feature: Content Sync Plan - Positive Create

        @Assert: Sync Plan is created
        """
        with Session(self.browser) as session:
            for interval in valid_sync_intervals():
                with self.subTest(interval):
                    name = gen_string('alphanumeric')
                    make_syncplan(
                        session,
                        org=self.organization.name,
                        name=name,
                        description=name,
                        sync_interval=interval,
                    )
                    self.assertIsNotNone(self.syncplan.search(name))
Example #43
0
    def test_positive_create_with_description(self):
        """Create Sync Plan with valid desc values

        @id: 6ccd2229-dcc3-4090-9ec9-84fea837c50c

        @Assert: Sync Plan is created
        """
        with Session(self.browser) as session:
            for desc in generate_strings_list():
                with self.subTest(desc):
                    name = gen_string('utf8')
                    make_syncplan(
                        session,
                        org=self.organization.name,
                        name=name,
                        description=desc,
                        sync_interval=choice(valid_sync_intervals()),
                    )
                    self.assertIsNotNone(self.syncplan.search(name))
Example #44
0
    def test_positive_create_with_sync_interval(self):
        """Create Sync Plan with valid sync intervals

        @id: 8916285a-c8d2-415a-b694-c32727e93ac0

        @Assert: Sync Plan is created
        """
        with Session(self.browser) as session:
            for interval in valid_sync_intervals():
                with self.subTest(interval):
                    name = gen_string('alphanumeric')
                    make_syncplan(
                        session,
                        org=self.organization.name,
                        name=name,
                        description=name,
                        sync_interval=interval,
                    )
                    self.assertIsNotNone(self.syncplan.search(name))
Example #45
0
    def test_positive_create_with_description(self):
        """Create Sync Plan with valid desc values

        @id: 6ccd2229-dcc3-4090-9ec9-84fea837c50c

        @Assert: Sync Plan is created
        """
        with Session(self.browser) as session:
            for desc in generate_strings_list():
                with self.subTest(desc):
                    name = gen_string('utf8')
                    make_syncplan(
                        session,
                        org=self.organization.name,
                        name=name,
                        description=desc,
                        sync_interval=choice(valid_sync_intervals()),
                    )
                    self.assertIsNotNone(self.syncplan.search(name))
Example #46
0
    def test_negative_create_with_same_name(self):
        """Create Sync Plan with an existing name

        @Feature: Content Sync Plan - Positive Create

        @Assert: Sync Plan cannot be created with existing name
        """
        name = gen_string('alphanumeric')
        with Session(self.browser) as session:
            make_syncplan(session, org=self.organization.name, name=name)
            self.assertIsNotNone(self.syncplan.search(name))
            make_syncplan(
                session,
                org=self.organization.name,
                name=name,
                description='with same name',
            )
            self.assertIsNotNone(self.syncplan.wait_until_element(
                common_locators['common_invalid']))
Example #47
0
    def test_negative_create_with_invalid_name(self):
        """Create Sync Plan with invalid names

        @id: 64724669-0289-4e8a-a44d-eb47e094ef18

        @Assert: Sync Plan is not created
        """
        with Session(self.browser) as session:
            for name in invalid_values_list(interface='ui'):
                with self.subTest(name):
                    make_syncplan(
                        session,
                        org=self.organization.name,
                        name=name,
                        description='invalid name',
                    )
                    self.assertIsNotNone(
                        self.syncplan.wait_until_element(
                            common_locators['common_invalid']))
Example #48
0
    def test_positive_create_with_sync_interval(self):
        """Create Sync Plan with valid sync intervals

        @id: 8916285a-c8d2-415a-b694-c32727e93ac0

        @Assert: Sync Plan is created
        """
        with Session(self.browser) as session:
            for interval in valid_sync_intervals():
                with self.subTest(interval):
                    name = gen_string('alphanumeric')
                    make_syncplan(
                        session,
                        org=self.organization.name,
                        name=name,
                        description=name,
                        sync_interval=interval,
                    )
                    self.assertIsNotNone(self.syncplan.search(name))
Example #49
0
    def test_positive_create_with_sync_interval(self):
        """Create Sync Plan with valid sync intervals

        @Feature: Content Sync Plan - Positive Create

        @Assert: Sync Plan is created
        """
        with Session(self.browser) as session:
            for interval in valid_sync_intervals():
                with self.subTest(interval):
                    name = gen_string('alphanumeric')
                    make_syncplan(
                        session,
                        org=self.organization.name,
                        name=name,
                        description=name,
                        sync_interval=interval,
                    )
                    self.assertIsNotNone(self.syncplan.search(name))
Example #50
0
    def test_negative_create_with_same_name(self):
        """Create Sync Plan with an existing name

        @id: 6d042f9b-82f2-4795-aa48-4603c1698aaa

        @Assert: Sync Plan cannot be created with existing name
        """
        name = gen_string('alphanumeric')
        with Session(self.browser) as session:
            make_syncplan(session, org=self.organization.name, name=name)
            self.assertIsNotNone(self.syncplan.search(name))
            make_syncplan(
                session,
                org=self.organization.name,
                name=name,
                description='with same name',
            )
            self.assertIsNotNone(
                self.syncplan.wait_until_element(
                    common_locators['common_invalid']))
Example #51
0
    def test_negative_create_3(self, name):
        """@Test: Create Sync Plan with an existing name

        @Feature: Content Sync Plan - Positive Create

        @Assert: Sync Plan cannot be created with existing name

        @BZ: 1087425

        """
        description = "with same name"
        # TODO: Due to bug 1087425 using common_haserror instead of name_error
        locator = common_locators["common_haserror"]
        with Session(self.browser) as session:
            make_syncplan(session, org=self.org_name, name=name)
            self.assertIsNotNone(self.syncplan.search(name))
            make_syncplan(session, org=self.org_name, name=name,
                          description=description, submit_validate=False)
            error = self.syncplan.wait_until_element(locator)
            self.assertIsNotNone(error)
Example #52
0
    def test_negative_create_with_invalid_name(self):
        """Create Sync Plan with invalid names

        :id: 64724669-0289-4e8a-a44d-eb47e094ef18

        :expectedresults: Sync Plan is not created

        :CaseImportance: Critical
        """
        with Session(self) as session:
            for name in invalid_values_list(interface='ui'):
                with self.subTest(name):
                    make_syncplan(
                        session,
                        org=self.organization.name,
                        name=name,
                        description='invalid name',
                    )
                    self.assertIsNotNone(self.syncplan.wait_until_element(
                        common_locators['common_invalid']))
Example #53
0
    def test_negative_create_with_same_name(self):
        """Create Sync Plan with an existing name

        :id: 6d042f9b-82f2-4795-aa48-4603c1698aaa

        :expectedresults: Sync Plan cannot be created with existing name

        :CaseImportance: Critical
        """
        name = gen_string('alphanumeric')
        with Session(self) as session:
            make_syncplan(session, org=self.organization.name, name=name)
            self.assertIsNotNone(self.syncplan.search(name))
            make_syncplan(
                session,
                org=self.organization.name,
                name=name,
                description='with same name',
            )
            self.assertIsNotNone(self.syncplan.wait_until_element(
                common_locators['common_invalid']))
Example #54
0
    def test_positive_synchronize_rh_product_past_sync_date(self):
        """Create a sync plan with past datetime as a sync date, add a
        RH product and verify the product gets synchronized on the next sync
        occurrence

        :id: 73a456fb-ad17-4921-b57c-27fc8e432a83

        :expectedresults: Product is synchronized successfully.

        :BZ: 1279539

        :CaseLevel: System
        """
        interval = 60 * 60  # 'hourly' sync interval in seconds
        delay = 5 * 60
        plan_name = gen_string('alpha')
        org = entities.Organization().create()
        with manifests.clone() as manifest:
            entities.Subscription().upload(
                data={'organization_id': org.id},
                files={'content': manifest.content},
            )
        repo_id = enable_rhrepo_and_fetchid(
            basearch='x86_64',
            org_id=org.id,
            product=PRDS['rhel'],
            repo=REPOS['rhst7']['name'],
            reposet=REPOSET['rhst7'],
            releasever=None,
        )
        repo = entities.Repository(id=repo_id).read()
        with Session(self) as session:
            startdate = (self.get_client_datetime(session.browser)
                         - timedelta(seconds=(interval - delay)))
            make_syncplan(
                session,
                org=org.name,
                name=plan_name,
                description='sync plan create with start time',
                interval=u'hourly',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            # Associate sync plan with product
            self.syncplan.update(
                plan_name, add_products=[PRDS['rhel']])
            # Verify product has not been synced yet
            with self.assertRaises(AssertionError):
                self.validate_task_status(repo.id, max_tries=2)
            self.logger.info('Waiting {0} seconds to check product {1}'
                             ' was not synced'.format(delay/4, PRDS['rhel']))
            sleep(delay/4)
            with self.assertRaises(AssertionError):
                self.validate_task_status(repo.id, max_tries=2)
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
                after_sync=False,
            )
            # Wait until the first recurrence
            self.logger.info('Waiting {0} seconds to check product {1}'
                             ' was synced'.format(delay, PRDS['rhel']))
            sleep(delay * 3/4)
            # Verify product was synced successfully
            self.validate_task_status(repo.id,
                                      repo_backend_id=repo.backend_identifier
                                      )
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
            )
Example #55
0
    def test_positive_synchronize_rh_product_future_sync_date(self):
        """Create a sync plan with sync date in a future and sync one RH
        product with it automatically.

        :id: 193d0159-d4a7-4f50-b037-7289f4576ade

        :expectedresults: Product is synchronized successfully.

        :CaseLevel: System
        """
        delay = 5 * 60  # delay for sync date in seconds
        plan_name = gen_string('alpha')
        org = entities.Organization().create()
        with manifests.clone() as manifest:
            entities.Subscription().upload(
                data={'organization_id': org.id},
                files={'content': manifest.content},
            )
        repo_id = enable_rhrepo_and_fetchid(
            basearch='x86_64',
            org_id=org.id,
            product=PRDS['rhel'],
            repo=REPOS['rhst7']['name'],
            reposet=REPOSET['rhst7'],
            releasever=None,
        )
        repo = entities.Repository(id=repo_id).read()
        with Session(self) as session:
            startdate = (self.get_client_datetime(session.browser)
                         + timedelta(seconds=delay))
            make_syncplan(
                session,
                org=org.name,
                name=plan_name,
                description='sync plan create with start time',
                interval=u'hourly',
                start_hour=startdate.strftime('%H'),
                start_minute=startdate.strftime('%M'),
            )
            # Associate sync plan with product
            self.syncplan.update(
                plan_name, add_products=[PRDS['rhel']])
            # Wait half of expected time
            self.logger.info('Waiting {0} seconds to check product {1}'
                             ' was not synced'.format(delay/2, PRDS['rhel']))
            sleep(delay / 4)
            # Verify product has not been synced yet
            with self.assertRaises(AssertionError):
                self.validate_task_status(repo.id, max_tries=2)
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
                after_sync=False,
            )
            # Wait the rest of expected time
            self.logger.info('Waiting {0} seconds to check product {1}'
                             ' was synced'.format(delay/2, PRDS['rhel']))
            sleep(delay * 3/4)
            # Verify product was synced successfully
            self.validate_task_status(repo.id)
            self.validate_repo_content(
                repo,
                ['erratum', 'package', 'package_group'],
            )