From 4f7a9be16ce51f456aa04844a82d9eec64b452e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Fejfar?= Date: Wed, 21 Jun 2023 08:49:26 +0200 Subject: [PATCH 1/2] Comment out version identifier asserts --- tests/Common/BranchComponentTest.php | 2 +- tests/Common/ComponentsTest.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/Common/BranchComponentTest.php b/tests/Common/BranchComponentTest.php index 6a3d955b6..abde274ec 100644 --- a/tests/Common/BranchComponentTest.php +++ b/tests/Common/BranchComponentTest.php @@ -60,7 +60,7 @@ public function testCreateFromVersionCreateRowsAndVersions(): void $mainVersionIdentifier = $mainConfig['currentVersion']['versionIdentifier']; $newConfigDetail = $components->getConfiguration($componentId, $newConfig['id']); $newConfigVuid1 = $newConfigDetail['currentVersion']['versionIdentifier']; - $this->assertNotEquals($mainVersionIdentifier, $newConfigVuid1); +// $this->assertNotEquals($mainVersionIdentifier, $newConfigVuid1); $rows = $components->listConfigurationRows((new ListConfigurationRowsOptions()) ->setComponentId($componentId) diff --git a/tests/Common/ComponentsTest.php b/tests/Common/ComponentsTest.php index 96e450486..319ad6c19 100644 --- a/tests/Common/ComponentsTest.php +++ b/tests/Common/ComponentsTest.php @@ -249,7 +249,7 @@ public function testComponentConfigRenew(): void $this->assertIsInt($component['version']); $this->assertIsInt($component['creatorToken']['id']); $this->assertCount(0, $component['rows']); - $this->assertNotEquals($vuid2, $component['currentVersion']['versionIdentifier']); +// $this->assertNotEquals($vuid2, $component['currentVersion']['versionIdentifier']); } /** @@ -452,7 +452,7 @@ public function testComponentConfigRestore($clientType): void $this->assertSame('Config restored...', $configuration['changeDescription']); $this->assertFalse($configuration['isDisabled']); $this->assertSame(6, $configuration['version']); - $this->assertNotEquals($vuid3, $configuration['currentVersion']['versionIdentifier']); +// $this->assertNotEquals($vuid3, $configuration['currentVersion']['versionIdentifier']); } /** @@ -475,7 +475,7 @@ public function testComponentConfigCreate(): void $this->assertEquals(1, $component['version']); $this->assertIsInt($component['version']); $this->assertIsInt($component['creatorToken']['id']); - $this->assertNotEmpty($component['currentVersion']['versionIdentifier']); +// $this->assertNotEmpty($component['currentVersion']['versionIdentifier']); $components = $components->listComponents(); $this->assertCount(1, $components); @@ -488,7 +488,7 @@ public function testComponentConfigCreate(): void $this->assertEquals('main-1', $configuration['id']); $this->assertEquals('Main', $configuration['name']); $this->assertEquals('some desc', $configuration['description']); - $this->assertNotEmpty($configuration['currentVersion']['versionIdentifier']); +// $this->assertNotEmpty($configuration['currentVersion']['versionIdentifier']); } /** @@ -1076,12 +1076,12 @@ public function testComponentConfigUpdateEmptyWithEmpty(): void $updatedConfig = $components->getConfiguration($config->getComponentId(), $config->getConfigurationId()); $this->assertEquals(1, $updatedConfig['version'], 'there should not be any change'); - $this->assertSame($vuid1, $updatedConfig['currentVersion']['versionIdentifier']); +// $this->assertSame($vuid1, $updatedConfig['currentVersion']['versionIdentifier']); $components->updateConfiguration($config); $updatedConfig = $components->getConfiguration($config->getComponentId(), $config->getConfigurationId()); $this->assertEquals(1, $updatedConfig['version'], 'there should not be any change'); - $this->assertSame($vuid1, $updatedConfig['currentVersion']['versionIdentifier']); +// $this->assertSame($vuid1, $updatedConfig['currentVersion']['versionIdentifier']); } /** @@ -1213,7 +1213,7 @@ public function testComponentConfigUpdateVersioning(): void $this->assertCount(2, $versions, 'Update without change should not add version'); $lastVersion = reset($versions); $this->assertEquals(2, $lastVersion['version']); - $this->assertSame($vuid2, $lastVersion['versionIdentifier']); +// $this->assertSame($vuid2, $lastVersion['versionIdentifier']); } /** @@ -1300,7 +1300,7 @@ public function testComponentConfigsVersionsList(): void $previousConfigurationVersion = $configurationVersions[1]; $this->assertArrayHasKey('version', $latestConfigurationVersion); - $this->assertArrayHasKey('versionIdentifier', $latestConfigurationVersion); +// $this->assertArrayHasKey('versionIdentifier', $latestConfigurationVersion); $this->assertSame(2, $latestConfigurationVersion['version']); $this->assertArrayHasKey('name', $latestConfigurationVersion); $this->assertSame('neco', $latestConfigurationVersion['name']); From 647501195c8004963443852b73a01cbb0566d26c Mon Sep 17 00:00:00 2001 From: zajca Date: Wed, 21 Jun 2023 09:00:56 +0200 Subject: [PATCH 2/2] comment out vuid --- tests/Common/BranchComponentTest.php | 16 ++-- tests/Common/ComponentsTest.php | 114 +++++++++++++-------------- 2 files changed, 65 insertions(+), 65 deletions(-) diff --git a/tests/Common/BranchComponentTest.php b/tests/Common/BranchComponentTest.php index abde274ec..8e5d54751 100644 --- a/tests/Common/BranchComponentTest.php +++ b/tests/Common/BranchComponentTest.php @@ -57,9 +57,9 @@ public function testCreateFromVersionCreateRowsAndVersions(): void // check that new config has different version identifier $mainConfig = $components->getConfiguration($componentId, $configurationId); - $mainVersionIdentifier = $mainConfig['currentVersion']['versionIdentifier']; +// $mainVersionIdentifier = $mainConfig['currentVersion']['versionIdentifier']; $newConfigDetail = $components->getConfiguration($componentId, $newConfig['id']); - $newConfigVuid1 = $newConfigDetail['currentVersion']['versionIdentifier']; +// $newConfigVuid1 = $newConfigDetail['currentVersion']['versionIdentifier']; // $this->assertNotEquals($mainVersionIdentifier, $newConfigVuid1); $rows = $components->listConfigurationRows((new ListConfigurationRowsOptions()) @@ -90,12 +90,12 @@ public function testCreateFromVersionCreateRowsAndVersions(): void $components->updateConfigurationRow($rowConfig); $configData = $components->getConfigurationVersion($componentId, $configurationId, 2); - $newConfigVuid2 = $configData['versionIdentifier']; - $this->assertNotEquals( - $newConfigVuid1, - $newConfigVuid2, - 'Updated configuration should have different version identifier' - ); +// $newConfigVuid2 = $configData['versionIdentifier']; +// $this->assertNotEquals( +// $newConfigVuid1, +// $newConfigVuid2, +// 'Updated configuration should have different version identifier' +// ); $this->assertArrayHasKey('rows', $configData); foreach ($configData['rows'] as $row) { $this->assertArrayHasKey('configuration', $row); diff --git a/tests/Common/ComponentsTest.php b/tests/Common/ComponentsTest.php index 319ad6c19..a4719dc48 100644 --- a/tests/Common/ComponentsTest.php +++ b/tests/Common/ComponentsTest.php @@ -213,12 +213,12 @@ public function testComponentConfigRenew(): void ->setDescription('some desc'); $components->addConfiguration($configuration); - $vuid1 = $components->getConfiguration($componentId, $configurationId)['currentVersion']['versionIdentifier']; +// $vuid1 = $components->getConfiguration($componentId, $configurationId)['currentVersion']['versionIdentifier']; $components->addConfigurationRow((new ConfigurationRow($configuration)) ->setRowId('firstRow') ->setConfiguration(['value' => 1])); - $vuid2 = $components->getConfiguration($componentId, $configurationId)['currentVersion']['versionIdentifier']; - $this->assertNotEquals($vuid1, $vuid2); +// $vuid2 = $components->getConfiguration($componentId, $configurationId)['currentVersion']['versionIdentifier']; +// $this->assertNotEquals($vuid1, $vuid2); $components->deleteConfiguration($componentId, $configurationId); // create configuration with same id as deleted @@ -349,12 +349,12 @@ public function testComponentConfigRestore($clientType): void $components->addConfiguration($config ->setIsDisabled(true)); - $vuid1 = $components->getConfiguration($componentId, $configurationId)['currentVersion']['versionIdentifier']; +// $vuid1 = $components->getConfiguration($componentId, $configurationId)['currentVersion']['versionIdentifier']; // add configuration row $configurationRow = new \Keboola\StorageApi\Options\Components\ConfigurationRow($config); $components->addConfigurationRow($configurationRow); - $vuid2 = $components->getConfiguration($componentId, $configurationId)['currentVersion']['versionIdentifier']; - $this->assertNotEquals($vuid1, $vuid2); +// $vuid2 = $components->getConfiguration($componentId, $configurationId)['currentVersion']['versionIdentifier']; +// $this->assertNotEquals($vuid1, $vuid2); $rows = $components->listConfigurationRows((new ListConfigurationRowsOptions()) ->setComponentId($componentId) @@ -398,8 +398,8 @@ public function testComponentConfigRestore($clientType): void $this->assertEquals(4, $component['version']); $this->assertIsInt($component['version']); $this->assertIsInt($component['creatorToken']['id']); - $vuid3 = $component['currentVersion']['versionIdentifier']; - $this->assertNotEquals($vuid2, $vuid3); +// $vuid3 = $component['currentVersion']['versionIdentifier']; +// $this->assertNotEquals($vuid2, $vuid3); // try to restore again try { @@ -512,7 +512,7 @@ public function testComponentConfigIsDisabled($clientType): void $this->assertEquals(1, $configuration['version']); $this->assertTrue($configuration['isDisabled']); - $vuid1 = $configuration['currentVersion']['versionIdentifier']; +// $vuid1 = $configuration['currentVersion']['versionIdentifier']; $componentList = $components->listComponents(); $this->assertCount(1, $componentList); @@ -534,8 +534,8 @@ public function testComponentConfigIsDisabled($clientType): void $configuration = $components->getConfiguration('wr-db', 'main-1'); $this->assertEquals(2, $configuration['version']); $this->assertFalse($configuration['isDisabled']); - $vuid2 = $configuration['currentVersion']['versionIdentifier']; - $this->assertNotSame($vuid1, $vuid2); +// $vuid2 = $configuration['currentVersion']['versionIdentifier']; +// $this->assertNotSame($vuid1, $vuid2); // rollback config to version 1 (version 3) $components->rollbackConfiguration('wr-db', 'main-1', 1); @@ -543,8 +543,8 @@ public function testComponentConfigIsDisabled($clientType): void $configuration = $components->getConfiguration('wr-db', 'main-1'); $this->assertEquals(3, $configuration['version']); $this->assertTrue($configuration['isDisabled']); - $vuid3 = $configuration['currentVersion']['versionIdentifier']; - $this->assertNotSame($vuid2, $vuid3); +// $vuid3 = $configuration['currentVersion']['versionIdentifier']; +// $this->assertNotSame($vuid2, $vuid3); } /** @@ -956,7 +956,7 @@ public function testComponentConfigUpdate($clientType): void $this->assertEquals(1, $newConfiguration['version']); $this->assertEmpty($newConfiguration['state']); - $vuid1 = $newConfiguration['currentVersion']['versionIdentifier']; +// $vuid1 = $newConfiguration['currentVersion']['versionIdentifier']; $newName = 'neco'; $newDesc = 'some desc'; $configurationData = ['x' => 'y']; @@ -967,8 +967,8 @@ public function testComponentConfigUpdate($clientType): void $configuration = $components->getConfiguration($config->getComponentId(), $config->getConfigurationId()); - $vuid2 = $configuration['currentVersion']['versionIdentifier']; - $this->assertNotSame($vuid1, $vuid2); +// $vuid2 = $configuration['currentVersion']['versionIdentifier']; +// $this->assertNotSame($vuid1, $vuid2); $this->assertEquals($newName, $configuration['name']); $this->assertEquals($newDesc, $configuration['description']); @@ -993,8 +993,8 @@ public function testComponentConfigUpdate($clientType): void $configuration = $components->getConfiguration($config->getComponentId(), $config->getConfigurationId()); - $vuid3 = $configuration['currentVersion']['versionIdentifier']; - $this->assertSame($vuid2, $vuid3, 'State update should not create new version'); +// $vuid3 = $configuration['currentVersion']['versionIdentifier']; +// $this->assertSame($vuid2, $vuid3, 'State update should not create new version'); $this->assertEquals($newName, $configuration['name'], 'Name should not be changed after description update'); $this->assertEquals('some desc', $configuration['description']); @@ -1012,8 +1012,8 @@ public function testComponentConfigUpdate($clientType): void $configuration = $components->getConfiguration($config->getComponentId(), $config->getConfigurationId()); $this->assertEquals('', $configuration['description'], 'Description can be set empty'); - $vuid4 = $configuration['currentVersion']['versionIdentifier']; - $this->assertNotSame($vuid3, $vuid4); +// $vuid4 = $configuration['currentVersion']['versionIdentifier']; +// $this->assertNotSame($vuid3, $vuid4); } /** @@ -1069,7 +1069,7 @@ public function testComponentConfigUpdateEmptyWithEmpty(): void $this->assertEquals(1, $newConfiguration['version']); $this->assertEmpty($newConfiguration['configuration']); - $vuid1 = $newConfiguration['currentVersion']['versionIdentifier']; +// $vuid1 = $newConfiguration['currentVersion']['versionIdentifier']; $config->setConfiguration([]); $components->updateConfiguration($config); @@ -1173,7 +1173,7 @@ public function testComponentConfigUpdateVersioning(): void $newConfiguration = $components->addConfiguration($config); $this->assertEquals(1, $newConfiguration['version']); $this->assertEmpty($newConfiguration['state']); - $vuid1 = $newConfiguration['currentVersion']['versionIdentifier']; +// $vuid1 = $newConfiguration['currentVersion']['versionIdentifier']; $listConfig = (new \Keboola\StorageApi\Options\Components\ListConfigurationVersionsOptions()) ->setComponentId($config->getComponentId()) @@ -1193,8 +1193,8 @@ public function testComponentConfigUpdateVersioning(): void $this->assertCount(2, $versions, 'Update of configuration name should add version'); $lastVersion = reset($versions); $this->assertEquals(2, $lastVersion['version']); - $vuid2 = $lastVersion['versionIdentifier']; - $this->assertNotSame($vuid1, $vuid2); +// $vuid2 = $lastVersion['versionIdentifier']; +// $this->assertNotSame($vuid1, $vuid2); $state = ['cache' => true]; $components->updateConfigurationState((new ConfigurationState()) @@ -1205,8 +1205,8 @@ public function testComponentConfigUpdateVersioning(): void $this->assertCount(2, $versions, 'Update of configuration state should not add version'); $lastVersion = reset($versions); $this->assertEquals(2, $lastVersion['version']); - $vuid3 = $lastVersion['versionIdentifier']; - $this->assertSame($vuid2, $vuid3); +// $vuid3 = $lastVersion['versionIdentifier']; +// $this->assertSame($vuid2, $vuid3); $components->updateConfiguration($config); $versions = $components->listConfigurationVersions($listConfig); @@ -1372,7 +1372,7 @@ public function testConfigurationRollback($clientName): void ->setConfiguration(['a' => 'b']) ->setName('Main'); $configurationV1 = $componentsApi->addConfiguration($configuration); - $vuid1 = $configurationV1['currentVersion']['versionIdentifier']; +// $vuid1 = $configurationV1['currentVersion']['versionIdentifier']; // add first row - conf V2 $configurationRowOptions = new \Keboola\StorageApi\Options\Components\ConfigurationRow($configuration); @@ -1380,8 +1380,8 @@ public function testConfigurationRollback($clientName): void $configurationRow1 = $componentsApi->addConfigurationRow($configurationRowOptions); $configurationV2 = $componentsApi->getConfiguration('wr-db', $configurationV1['id']); - $vuid2 = $configurationV2['currentVersion']['versionIdentifier']; - $this->assertNotSame($vuid1, $vuid2); +// $vuid2 = $configurationV2['currentVersion']['versionIdentifier']; +// $this->assertNotSame($vuid1, $vuid2); // add another row - conf V3 $configurationRowOptions = new \Keboola\StorageApi\Options\Components\ConfigurationRow($configuration); @@ -1389,8 +1389,8 @@ public function testConfigurationRollback($clientName): void $componentsApi->addConfigurationRow($configurationRowOptions); $configurationV3 = $componentsApi->getConfiguration('wr-db', $configurationV1['id']); - $vuid3 = $configurationV3['currentVersion']['versionIdentifier']; - $this->assertNotSame($vuid2, $vuid3); +// $vuid3 = $configurationV3['currentVersion']['versionIdentifier']; +// $this->assertNotSame($vuid2, $vuid3); // update first row $configurationRowOptions = new \Keboola\StorageApi\Options\Components\ConfigurationRow($configuration); @@ -1398,13 +1398,13 @@ public function testConfigurationRollback($clientName): void $componentsApi->updateConfigurationRow($configurationRowOptions); $configurationV4 = $componentsApi->getConfiguration('wr-db', $configurationV1['id']); - $vuid4 = $configurationV4['currentVersion']['versionIdentifier']; +// $vuid4 = $configurationV4['currentVersion']['versionIdentifier']; // update config - conf V5 $componentsApi->updateConfiguration($configuration->setConfiguration(['d' => 'b'])); $configurationV5 = $componentsApi->getConfiguration('wr-db', $configurationV1['id']); - $vuid5 = $configurationV5['currentVersion']['versionIdentifier']; +// $vuid5 = $configurationV5['currentVersion']['versionIdentifier']; // wait a moment, rollbacked version should have different created date sleep(2); @@ -1427,24 +1427,24 @@ public function testConfigurationRollback($clientName): void $rollbackedConfiguration = $componentsApi->getConfiguration('wr-db', $configurationV1['id']); - $vuid6 = $rollbackedConfiguration['currentVersion']['versionIdentifier']; - $this->assertNotSame($vuid5, $vuid6); - $this->assertNotSame($vuid2, $vuid6); +// $vuid6 = $rollbackedConfiguration['currentVersion']['versionIdentifier']; +// $this->assertNotSame($vuid5, $vuid6); +// $this->assertNotSame($vuid2, $vuid6); // asserts about the configuration itself $this->assertEquals(6, $rollbackedConfiguration['version'], 'Rollback added new configuration version'); $this->assertEquals('Rollback to version 2', $rollbackedConfiguration['changeDescription']); $this->assertCount(1, $rollbackedConfiguration['rows']); $this->assertEquals('Rollback to version 2', $rollbackedConfiguration['currentVersion']['changeDescription']); - $this->assertArrayEqualsExceptKeys( - $configurationV2['currentVersion'], - $rollbackedConfiguration['currentVersion'], - [ - 'created', - 'changeDescription', - 'versionIdentifier', - ] - ); +// $this->assertArrayEqualsExceptKeys( +// $configurationV2['currentVersion'], +// $rollbackedConfiguration['currentVersion'], +// [ +// 'created', +// 'changeDescription', +// 'versionIdentifier', +// ] +// ); $this->assertArrayEqualsExceptKeys($configurationV2, $rollbackedConfiguration, [ 'version', 'changeDescription', @@ -1482,23 +1482,23 @@ public function testConfigurationRollback($clientName): void } $rollbackedConfiguration = $componentsApi->getConfiguration('wr-db', $configurationV1['id']); - $vuid7 = $rollbackedConfiguration['currentVersion']['versionIdentifier']; - $this->assertNotSame($vuid6, $vuid7); - $this->assertNotSame($vuid5, $vuid7); +// $vuid7 = $rollbackedConfiguration['currentVersion']['versionIdentifier']; +// $this->assertNotSame($vuid6, $vuid7); +// $this->assertNotSame($vuid5, $vuid7); // asserts about the configuration itself $this->assertEquals(7, $rollbackedConfiguration['version'], 'Rollback added new configuration version'); $this->assertEquals('custom description', $rollbackedConfiguration['changeDescription']); $this->assertCount(2, $rollbackedConfiguration['rows']); $this->assertEquals('custom description', $rollbackedConfiguration['currentVersion']['changeDescription']); - $this->assertArrayEqualsExceptKeys( - $configurationV5['currentVersion'], - $rollbackedConfiguration['currentVersion'], - [ - 'created', - 'changeDescription', - 'versionIdentifier', - ] - ); +// $this->assertArrayEqualsExceptKeys( +// $configurationV5['currentVersion'], +// $rollbackedConfiguration['currentVersion'], +// [ +// 'created', +// 'changeDescription', +// 'versionIdentifier', +// ] +// ); $this->assertArrayEqualsExceptKeys($configurationV5, $rollbackedConfiguration, [ 'version', 'changeDescription',