Incorrect session attribute values after upgrade to Gatling 3.10.3/Scala 2.13

Hi. I have a very weird issue going on where some code that generates dynamic data feeders from json (from rest assured responses) is now resulting in session attributes like the following:

placementIdList -> ArraySeq(1100022317, 1100022316)

Rather than:

placementIdList -> 1100022317, 1100022316

Is this because of a difference between Scala 2.13 and 2.12? All responses are greatly appreciated. This is the only thing blocking our Gatling upgrade and is a runtime issue only where we get bad session attribute values. Thanks!!

Here is the code involved in producing those session attributes:

override def getPlacements: Array[Map[String, Any]] = {
    val placementResponse: java.util.ArrayList[java.util.HashMap[String, Any]] =
      placementsFromHibernate("id,candidate,jobOrder,clientCorporation,clientContact,customText35")
    val placementList: List[java.util.HashMap[String, Any]] = placementResponse.asScala.toList
    for (placement <- placementList) placement.asScala.toMap
    val placementInitialSessionVars: List[scala.collection.mutable.Map[String, Any]] =
      placementList.map(placement => scala.collection.mutable.Map[String, Any]("placementId" -> placement.get("id"),
        "placementCandidate" -> placement.get("candidate"), "placementCorporateUser" -> placement.get("customText35"),
        "placementJobOrder" -> placement.get("jobOrder"), "placementClientCorp" -> placement.get("clientCorporation"),
        "placementClientContact" -> placement.get("clientContact")))
    for (placement <- placementInitialSessionVars) {
      val candidate = placement("placementCandidate").asInstanceOf[java.util.HashMap[String, Any]].asScala.toMap
      val jobOrder = placement("placementJobOrder").asInstanceOf[java.util.HashMap[String, Any]].asScala.toMap
      val clientCorp = placement("placementClientCorp").asInstanceOf[java.util.HashMap[String, Any]].asScala.toMap
      val clientContact = placement("placementClientContact").asInstanceOf[java.util.HashMap[String, Any]].asScala.toMap

      placement += ("placementCandidateId" -> candidate.get("id").get)
      placement += ("placementJobOrderId" -> jobOrder.get("id").get)
      placement += ("placementClientCorpId" -> clientCorp.get("id").get)
      placement += ("placementClientContactId" -> clientContact.get("id").get)
    }

      placement += ("placementCandidateId" -> candidate.get("id").get)
      placement += ("placementJobOrderId" -> jobOrder.get("id").get)
      placement += ("placementClientCorpId" -> clientCorp.get("id").get)
      placement += ("placementClientContactId" -> clientContact.get("id").get)
    }

    placementInitialSessionVars.map(placement => placement.toMap).toArray
  }

Here is an example where the session attributes are used:

  .exec( session => {
        session
          .set("placementIdList", buildStringListFromSession(session, "placementId"))

Which calls:

  def buildStringListFromSession(session: Session, filterBy: String): String = {
    val allSessionVariables: Map[String, Any] = session.attributes
    val filteredSessionVariables: Map[String, Any] = allSessionVariables.filter((variable) => variable._1 startsWith(filterBy))
    val uniqueIdsList: Set[Any] = filteredSessionVariables.values.toSet

    uniqueIdsList.mkString(",")
  }

Hi,

Sorry but your code is too complicated to be investigated.
Please try to come up with a more simple reproducer that meets the expected requirements: How to create a Minimal, Reproducible Example - Help Center - Stack Overflow

Regards

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.