Skip to content

Commit

Permalink
fix #3628 removing sorting from lists and templates
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins authored and manusa committed Mar 1, 2022
1 parent 3cb52b3 commit 21ee5fb
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 182 deletions.
5 changes: 5 additions & 0 deletions doc/MIGRATION-v6.md
Expand Up @@ -4,6 +4,7 @@
- [API/Impl split](#api-impl-split)
- [Deprecation Removals](#deprecation-removals)
- [IntOrString changes](#intorstring-changes)
- [Object sorting](#object-sorting)

## API/Impl split

Expand Down Expand Up @@ -64,3 +65,7 @@ We've removed setter methods `setIntVal`, `setKind`, `setStrVal` from the class.
IntOrString i2 = new IntOrString("3000");
String strValue = i2.getStrVal();
```

## Object Sorting

KubernetesList and Template will no longer automatically sort their objects by default. You may use the HasMetadataComparator to sort the items as needed.
Expand Up @@ -182,8 +182,8 @@ void testResourceListCreateOrReplace() throws IOException {

// Then
verify(mockClient, times(2)).send(any(), any());
assertRequest("POST", "/api/v1/namespaces/ns1/services", "dryRun=All");
assertRequest(1, "POST", "/api/v1/namespaces/ns1/pods", "dryRun=All");
assertRequest("POST", "/api/v1/namespaces/ns1/pods", "dryRun=All");
assertRequest(1, "POST", "/api/v1/namespaces/ns1/services", "dryRun=All");
}

@Test
Expand All @@ -197,8 +197,8 @@ void testResourceListDelete() throws IOException {

// Then
verify(mockClient, times(2)).send(any(), any());
assertRequest("DELETE", "/api/v1/namespaces/ns1/services/svc1", "dryRun=All");
assertRequest(1, "DELETE", "/api/v1/namespaces/ns1/pods/pod1", "dryRun=All");
assertRequest("DELETE", "/api/v1/namespaces/ns1/pods/pod1", "dryRun=All");
assertRequest(1, "DELETE", "/api/v1/namespaces/ns1/services/svc1", "dryRun=All");
}

private Pod getPod(String name) {
Expand Down
Expand Up @@ -71,8 +71,6 @@ public String getApiVersion() {

@Override
public List<HasMetadata> getItems() {
List<HasMetadata> sortedItems = new ArrayList<>(super.getItems());
Collections.sort(sortedItems, new HasMetadataComparator());
return sortedItems;
return super.getItems();
}
}
19 changes: 0 additions & 19 deletions kubernetes-model-generator/openshift-model/pom.xml
Expand Up @@ -99,25 +99,6 @@
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<target>
<echo>Removing the duplicate generated class</echo>
<delete
file="${generate.targetDirectory}/io/fabric8/openshift/api/model/Template.java"
verbose="true" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down

0 comments on commit 21ee5fb

Please sign in to comment.